Fonction de recherche dans un datagrid

E

Esperanza

Bonjour .net expert !!
Voici mon problème,

J'ai fait une petite fonction de recherche pour un datagrid.
Mon problème est que si je ne suis pas positionné à la page un du DataGrid.
la fonction de recherche me retourne un message d'erreur.


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


Merci d'avance !!
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;
}


}
 
S

Sylvain Lafontaine

Premièrement, vous devriez poser votre question dans un des groupes de
discussion francophones.

Deuxièmement, la valeur CurrentPageIndex ne fait pas partie de l'extrait de
code présenté; difficile de voir alors d'où pourrait provenir le problème.

S. L.
 
K

Ken Cox [Microsoft MVP]

Voici un des groupes de discussion francophones dont Sylvain parlait:

microsoft.public.fr.dotnet.aspnet
 

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

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top