|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
search function on different page selectedHere 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; } } 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 Show quoteHide quote >-----Original Message----- System.EventArgs e)>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, Show quoteHide quote > { > > 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; > } > > >} > > > > >. >
5th Re-Post with NO RESPONSE FROM MS!
Hyperlink Format Can't get a reference to user control in datagrid How to capture CheckChanged event from Radiobutton in Datagrid? Problem with Top And Bottom Paging email validation radiobutton and datagrid DataGrid sort when Editing Handling events for Checkbox in Data Grid How to put the result of 2 DataReader in a DataList?? |
|||||||||||||||||||||||