Hiding Regions - Alternatives

D

Doug

Looking for opinions/suggestions:

Suppose I have a "region" of an aspx page I want to hide or show based on
whatever runtime conditions. Additionally, the entire region is defined by
an HTML <TABLE>. There is nothing else in the region beyond whatever is
contained in the <TABLE>.

I see at least two options for showing/hiding this region.

1. Wrap the table in an <ASP:panel> and set the panel's Visible property to
show or hide the region (I've done this and it works fine - just have to be
mindful of the Panel's EnableViewState setting depending on what other
controls exist in the region).

2. Define the <Table> With Runat=Server so I can access it's properties from
the code-behind; then set it's Visible property to show or hide the region
(I've never actually done this so I don't know if it would even work).

In any case - which would be better between these alternatives? Any
additional alternatives? Rationalle for making a choice?

Thanks.
 
D

Dave Fancher

Whenever I have this scenario I typically use the second option. In either
case you're working with a server control but the second otpion using
HtmlControl (the table runat="server") will have slightly less overhead and
will keep some unnecessary clutter out of your document structure.

If this table is something that you're going to allow the user to toggle
between displayed and hidden you may want to consider using a DHTML approach
and move the burden from the server as well as reduce the number of trips to
the server...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top