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;
}
}
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;
}
}