Thanks for Mark's informative input.
Hi Doug,
I also suggest you use the "display" css style to hide the ListBox rather
than use ASP.NET server-side "Visible" property. This is because css style
only hide the client-side html element display, but won't affect the
server-side control's population(or other processing). However, setting
the server-side Visible property will make the control not considered
existing on the page's control collection.
Anyway, the "display" css style is also very useful when you want to use
script to show/hide an certain control/html element on the page.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "Mark Rae [MVP]" <ma**@markNOSPAMrae.net>
References: <#P**************@TK2MSFTNGP03.phx.gbl>
In-Reply-To: <#P**************@TK2MSFTNGP03.phx.gbl>
Subject: Re: Hidden llist box does not populate
Date: Thu, 26 Jun 2008 01:09:10 +0100
>
"dbuchanan" <db*******@newsgroup.nospamwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>I intend to populate a listBox from the database for later use. (the
intent for doing this is irrelevant to this questrion)
The list box when hidden is never populated. The list box when visible
is
>always populatd. How do I populate it even though it remains hidden?
When you say "hidden" do you mean that you are setting the ListBox's
Visible
>property to false? If so, then the ListBox will not even be rendered to
the
>client browser...
If you want a webcontrol to be rendered to the browser but not displayed,
then you need to set its "display" attribute to "none" e.g.
MyListBox.Attributes.Add("display", "none");
or
MyListBox.Attributes.Add("style", "display:none;");
--
Mark Rae
ASP.NET MVP
http://www.markrae.net