Populating CSLADataSource on button click

Populating CSLADataSource on button click

Old forum URL: forums.lhotka.net/forums/t/1570.aspx


rhinoishere posted on Monday, October 23, 2006

When my webform loads for the first time, the gridview on the page is set to "visible = false".  Then, when I click a button that loads the gridview with search results, I just set the grid's visible property to true. The data loads in the grid as it should. The problem comes when I change the search criteria and click the button again. How do I re-load the grid. Setting the grid's visible property to false and back to true again does not work. 

Any help is appreciated.

thanks, Ryan

rhinoishere replied on Monday, October 23, 2006

Nevermind. I was caching the object in the session on the first search and it was always just reusing that businss object.

For any other noob that finds this post and are doing the same thing, try setting your gridview to "visible = false" on first page load (otherwise it will try to run your search on the first page load with presumably emtpy search criteria). Then, when you click your button, you just need to set your grid to "visible = true" and do a "this.gridView.DataBind()".

thanks, Ryan

Copyright (c) Marimer LLC