3
Answers

Having a gridview to disappear when doing changes in a listbox

jesbon

jesbon

14y
4.4k
1

Hi,
I have a listbox (lstBox1) that is populating a another listbox (lstBox2) with items depending on what is selected in lstBox1. lstBox2 is populated automatically when items in lstBox1 is selected and/or changed (autopostback). Then when I have selected items in both lstBox1 and lstBox2 I have a 'View' button that loads and visualize the result for selected items in lstBox1 and lstBox2.
 
Now to my question - I want that as soon I change item in lstBox1 the visualized gridview shall disappear from the page and first be visualized again after the 'View' button is pushed again. That means I want the autopostback (SelectedIndexChanged) for lstBox1 shall remove visualized gridview and just populate lstBox2 with new items.
 
How to realize this? I must (I assume) of course trigger this in SelectedIndexChanged function for lstBox1 in some way.
 
Thx in advance for your help!
Answers (3)