views:

135

answers:

2

Is it possible to do the above? i.e. I have a gridview that binds to a data set. Currently I have a ddl that when a client clicks on it, the gridview 'disappears'.

(i.e. $('#GridView1').remove();)

However this does not remove the bind and therefore when a postback occurs, the gridview is populated with the 'erased' dataset.

Can I use jquery to effectively 'unbind' this gridview's dataset?

A: 

I've actually managed to fool my web application...when a user selects either the drop down, text box or radio button list, a postback is made. I therefore just did a cop out and bound the gridview to a null datasource at this point..therefore, when the page is refreshed, nothing will be presented in the gridview.

A nice little cheat!

MrDean
A: 

When the gridview is removed using jquery, you have to tell the code behind part that your gridview is removed. There are various ways to do that. One is to use a cookie, or a querystring parameter, or something else. So when the page is posted back, that variable will be checked before binding the dataset. Because removing gridview using jquery will not remove it from page's control collection at the server side. So, a check would be needed everytime.

pokrate