search function on different page selected

E

Esperanza

Hello .net expert !!
Here is my problem,

I made a litle function to do a search on a dataGrid
It works fine if I do the search while page 1 is selected.
Otherwise (if page 5 is selected example) I got the following error :

Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount


Thanks in advance !!
Esperanza

Here it goes :

//******************************************************
private void btnRecherche_Click(object sender, System.EventArgs e)
{

string strVar;
string strSelection;
strVar = this.txtRecherche.Text;

strSelection = this.RadListSearch.SelectedItem.Text;

try
{
if (strVar.Trim()!=null)
{

switch(strSelection)

{
//Recherche par nom
case "Nom":
this.dataViewGPPL.RowFilter = "XABALPH like '%" + strVar + "%'";
break;

//Recherche par no Téléphone
case "No tel.":
this.dataViewGPPL.RowFilter = "XTEL like '" + strVar + "'";
break;

}//fin du switch

//faire le bind
this.sqlCommandGPPL.Parameters["@GLNOTECH"].Value =
Session["Client_TECH_RDV"];
this.sqlDataAdapGPPL.Fill(dataSet11);

this.DataGrid1.DataSource = dataViewGPPL;
this.DataGrid1.DataBind();

}//fin du if


}//fin du try


catch (Exception ex)
{
throw ex;
}


}
 
E

Elton Wang

Hi Esperanza,

Do you know in which line the exception occurs? From your
code I can only see a button click event. I can't see any
thing related to CurrentPageIndex. Hope you can show more
info.

Elton Wang
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top