Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
597
Items Disappear after Postback
posted

I have a webpanel with a table and a listbar with items in it that I want the client to select one, when they don't I add text to a div on the submit button click.  When the page reloads none of the listbar items are there, the table is there and the buttons but they are disabled.  Help Please....

Parents
  • 45049
    posted

    Once you add your controls to the WebListbar dynamically, you need to add the controls back to the WebListbar again at the same point in the page lifecycle, if you want these controls to function correctly.  If you're adding the controls in response to a button click, it becomes very hard to add them again at the right time during subsequent postbacks.  This behavior is common among ASP.NET controls, and isn't unique to WebListbar.

    My suggestion is to not put the control in the WebListbar dynamically in the first place.  Instead, put it in at design-time, with its Visible property set to false so that it doesn't render to your page's HTML output.  In response to your button click, set the Visible property to true.  That way, you'll know that your control exists when you need it.

Reply Children