Hi

I have a simple search form which provides results via a datagrid on the same webpage, it works great. Except if you change the search criteria slightly and then instead of clicking search you instead click to page 2 of the results. Then it trys to go to page 2 but revaluates the search criteria and I get an error then if there are two pages of results under the new search criteria. How do not reload the search criteria if the paging is changed?

private void btnSearch_Click(object sender, System.EventArgs e)
{
BindGrid();
}

private void BindGrid()
{
grdSearchResults.PageSize = 10;
grdSearchResults.PagerStyle.Mode = PagerMode.NumericPages;

Induction.WebModules.InductionDB Data = new Induction.WebModules.InductionDB(GetConnStr());

// search for all authorisers if 0
int lAuthoriserID = 0;
if (AuthoriserID.SelectedItem.Value != "All")
{
lAuthoriserID = int.Parse(AuthoriserID.SelectedItem.Value);
}
int lAuthoriseStatusID = 0;
if (AuthoriseStatusID.SelectedItem.Value != "All")
{
lAuthoriseStatusID = int.Parse(AuthoriseStatusID.SelectedItem.Value);
}

DataSet InducteeDataSet = Data.SearchInducteeAuthoriserHome(NameFirst.Text, NameLast.Text, lAuthoriserID, lAuthoriseStatusID, SortField);
if (InducteeDataSet.Tables[0].Rows.Count != 0)
{
Message.Text = "";
Message.Visible = false;
pnlSearchResults.Visible = true;
grdSearchResults.DataSource = InducteeDataSet.Tables[0].DefaultView;
grdSearchResults.DataBind();
}
else
{
pnlSearchResults.Visible = false;
Message.Visible = true;
Message.Text = "No people found under this search criteria";
}
}

Regards

Steve