Not sure if you fixed this yet, but I'll give you the answer.
If your trying to use the new ASP.NET 2.0 approach to a "codeless" Gridview you need to do just that.. make it "codeless". You adding the code to the Search button postback event I assume:
SqldataSource1.FilterExpression = "LastName = '" + txtFilterValue.Text + "'";
This is wrong. You have bypassed the "codeless" functionality of the control by doing this. It loses its state when the page is refreshed or repaged. The values you set are not saved in viewstate. So everytime your page posts back you lose your filter expression. You need to put the expression in the control. For example. Say i have a text box with a search button:
<tr><td>
<asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>
<asp:Button ID="btnSearch" runat="server" OnClick="btnSearch_Click" Text="Search" />
</td></tr>
You don't need any code behind the search button. By clicking it you cause a postback to occur which rebinds the state of the control. in the gridview's datasource you need to add:
<asp:SqlDataSource
ID="SqlDataSource3"
runat="server"
ConnectionString="<%$ ConnString %>"
SelectCommand="GetData"
SelectCommandType="StoredProcedure"
FilterExpression="Description like '%{0}%'">
<FilterParameters>
<asp:ControlParameter ControlID="txtSearch" Name="Description" PropertyName="Text" />
</FilterParameters>
</asp:SqlDataSource>
the "filter expression" and "filter parameters" are processed on each postback. As long as there is data in the textbox.. which is saved in viewstate, the grid will be filtered by the expression.
Hope this helps.
Gavin Stevens
MCSD.NET, MCAD.NET, MCSD
Gavin.Stevens@GMail.com