Best way to use panels and tables?

aamznhec

New Member
I have found the asp:panel control to be very useful in designing my pages.<BR><BR>I thought it would be a great way to turn certain tables of information on and off depending on certain events.<BR><BR>Example...<BR><BR>Say I have two panels on a page, within each panel is a set of tables with some basic HTML elements in there.<BR><BR>If a user comes to the page and they don't have an id value i the query string I show them panel A (pnlA) but if they do have that id I show them panel B (pnlB).<BR><BR>Works great in IE but in netscape (4.7 and 6) it screws up the formatting. I viewed the source and it appears that each panel (at least the visible ones) actually creates a table tag...well, this extra table tag is killing netscape.<BR><BR>The main problem comes with I put panels inside of a table...say I want to be able to turn the various tr's on and off depending on certain events...so my table maybe have 3 panels and each one (when on) adds a table tag inside my table.<BR><BR>What are you guys doing to solve this? I am looking for a nice and easy way to be able to turn tables and tr's within a table on and off as needed.<BR><BR>I tried adding an id value to the table and tr's but I am not able to turn the actual table or tr on/off. I have tried things like...<BR><BR>tblCartPanel.Enabled = False<BR> <BR>or<BR><BR>tblCartPanel.Visible = False<BR><BR>...but I guess that is not allowed.<BR><BR>Any ideas?Use the asp:table control... you can turn the table on and off with the visible property... you can also do the same thing to the asp:tablerow and asp:tablecell<BR><BR>here's the link to the class at msdn<BR><BR>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUIWebControlsTableClassTopic.aspI agree that Panels are pretty neat.<BR><BR>I'm using them pretty sparingly at the moment until I fully understand the reasons behind where to use them. I guess that I'd be concerned about using them too often in pages or hiding larger chunks of information because of the Bloat Factor to the ViewState. I think that you'd need to be careful about that.<BR><BR>I mainly use Panels to make logical groupings of controls on a Page. That way I can refer to the Child controls of a Panel as a specific group (or UNIT of work) of controls.<BR><BR>Just thought that I'd throw that in to the discussion.Yup, this works perfectly....thanks for the info! Now I am wondering what I need panels for at all (considering everything I have is in a table anyhow).<BR><BR>Thanks again.
 
Back
Top