Grid paging

I have a gridview where I enabled paging. but when I click on the second page, gridview disappears here is the C # code:

protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridView1.PageIndex = e.NewPageIndex; OdbcDataAdapter adpState = new OdbcDataAdapter("SELECT CALL_NO,TDATE, ID_NO,NAME,CONTACT,DEPARTMENT,ISSUE,STATUS FROM TBL_ITHELPDESK WHERE (STATUS IS NULL OR STATUS <> 'CLOSED') AND TDATE= TO_DATE('" + txtDate.Text.ToString().Trim() + "','MM-DD-YYYY')", con1); DataSet ds = new DataSet(); adpState.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); } 

can someone help find where i'm wrong

+4
source share
1 answer

You need to check a few things.

  • Check the query with the one that works, is that the same?
  • Checking the variable con1 is defined outside of any other method.

Define con1 in the class, not in the method, something like this

  odbcConnection con = new odbcConnection(ConectionString); 
+4
source

All Articles