Hidden llist box does not populate

Discussion in 'ASP .Net' started by dbuchanan, Jun 26, 2008.

  1. dbuchanan

    dbuchanan Guest

    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?

    Thanks,
    Doug
    dbuchanan, Jun 26, 2008
    #1
    1. Advertising

  2. 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:
    .

    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications.
    ==================================================
    This posting is provided "AS IS" with no warranties, and confers no rights.
    --------------------
    >From: "Mark Rae [MVP]" <>
    >References: <#>
    >In-Reply-To: <#>
    >Subject: Re: Hidden llist box does not populate
    >Date: Thu, 26 Jun 2008 01:09:10 +0100


    >
    >"dbuchanan" <> wrote in message
    >news:%...
    >
    >> 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
    >
    >
    Steven Cheng [MSFT], Jun 26, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gnarlodious
    Replies:
    4
    Views:
    17,577
    elizas
    May 5, 2010
  2. Rick
    Replies:
    3
    Views:
    8,137
    Alexey Smirnov
    Apr 13, 2010
  3. Adrian
    Replies:
    1
    Views:
    218
    Bullschmidt
    Feb 18, 2004
  4. Enjoy Life
    Replies:
    2
    Views:
    271
    Roland Hall
    Feb 23, 2005
  5. SolarCanine
    Replies:
    2
    Views:
    264
    SolarCanine
    Sep 20, 2005
Loading...

Share This Page