jbailey268
Programmer
I have a gridview that is linked to SqlDataSource1 whose query is (by default) select * from clients. The form allows searching by 1st & last name.
Now when values are entered in text boxes for first and last name, and I enter "JOHN" and "WIL" and press go - what I do is make sqldatasource1.selectCommand= "Select * from clients where fname = <the value in fname > and lname = <value in lname>. (pseudo code.)
Anyway the grid populates correctly I get all the John Wilsons and the John Williams etc.
But there are 3 pages in the grid. When I click to page 2 the grid repopulates as if the SQLDataSOurce defaults back to all Clients. This also occurs when I click the column header(s) since I allowed sorting.
I tried storing Session("name") variable to the user defined query. Someone suggests looking at the Post Back features or the ONPageChange event. But I am not really changing the page per se, just moving to a different gridview page not a different aspx.
I am using 2005 Visual Studio. Perplexing. Why would the SQLDatasource revert if I set it at runtime?
Thanks in advance for your consideration. I hope the solution is simple, relatively new to .NET.
Now when values are entered in text boxes for first and last name, and I enter "JOHN" and "WIL" and press go - what I do is make sqldatasource1.selectCommand= "Select * from clients where fname = <the value in fname > and lname = <value in lname>. (pseudo code.)
Anyway the grid populates correctly I get all the John Wilsons and the John Williams etc.
But there are 3 pages in the grid. When I click to page 2 the grid repopulates as if the SQLDataSOurce defaults back to all Clients. This also occurs when I click the column header(s) since I allowed sorting.
I tried storing Session("name") variable to the user defined query. Someone suggests looking at the Post Back features or the ONPageChange event. But I am not really changing the page per se, just moving to a different gridview page not a different aspx.
I am using 2005 Visual Studio. Perplexing. Why would the SQLDatasource revert if I set it at runtime?
Thanks in advance for your consideration. I hope the solution is simple, relatively new to .NET.