Home All Groups Group Topic Archive Search About

Fonction de recherche dans un datagrid

Author
14 Mar 2005 8:02 PM
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;
   }


}

Author
15 Mar 2005 5:24 AM
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.

Show quoteHide quote
"Esperanza" <esperanza***@hotmail.com> wrote in message
news:%232E9TCNKFHA.1948@TK2MSFTNGP14.phx.gbl...
> 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;
>   }
>
>
> }
>
>
>
>
>
Author
15 Mar 2005 10:23 PM
Ken Cox [Microsoft MVP]
Voici un des groupes de discussion francophones dont Sylvain parlait:

microsoft.public.fr.dotnet.aspnet

Show quoteHide quote
"Esperanza" <esperanza***@hotmail.com> wrote in message
news:%232E9TCNKFHA.1948@TK2MSFTNGP14.phx.gbl...
> Bonjour .net expert !!
> Voici mon problème,
>