I am developing a web app using C#, .net 4. I have a grid view which is bound to a SqlDataSource. There are about more than one crore records of this data source. This is because, I have allowed paging. I have a filter criteria on the same page. User selects options using checkboxes. And then on the event of filter Button, I wrote some code which builds a new SELECT command according to the filter options for SqlDataSource. And after building a new query. I wrote another line of code which is:
DataGridView.SelectCommand= FilteredQuery;
So when user clicks FilterButton, the gridview shows the filtered data. As i told you, I have allowed Paging. So after filteration, when i selects the next button of that gridview, it shows the whole data instead of Filtered one. I think this is because it postsbacks the page and binds the gridview according to the predefined SELECT command for SqlDataSource.
I tried many approaches. I used static bool variable to keep track on page_load event. It works fine then. But it still troubles when i nevigate from one page to another. When i come back to this page, it still shows the filtered data.
I have very less time. Please guide me as soon as possible. Remember, I’m totally new to dot net technologies. So any detailed guidance will be highly appreciated. Thanks.
Best Regards!
You have to create OnPageIndex Changed event
And in code behind