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!
Loading
Justin RussoPosted Dec 10, 2009, 12:02 PM
jesbonPosted Sep 29, 2009, 1:32 AM
I solved the problem with adding following in the beginning of
protected void lstKundNr_SelectedIndexChanged(object sender, EventArgs e)
{
GridView1.Dispose();
GridView1.DataBind();
...
}
This will remove datagrid from memory and having it disappear from result page/area.
arun sharmaPosted Sep 28, 2009, 3:04 PM
protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
datagridview1.visible = false;
}
protected void Button1_Click(object sender, EventArgs e)
{
datagridview1.visible = true;
}
Arun sharma