By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,971 Members | 900 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,971 IT Pros & Developers. It's quick & easy.

Hiding Regions - Alternatives

P: n/a
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.
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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...

"Doug" <Cl******@Livermore.com> wrote in message
news:uk**************@TK2MSFTNGP10.phx.gbl...
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.

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.