Hi All,
I am trying to get paging to work on a GridView control, also I cannot access any particular piece of data. First some code:
da.TableMappings.Add("Deals", "Deals1")
dc = New SqlCommand(ssql, conn)
da.SelectCommand = dc
da.Fill(ds, ssql)
GridView1.DataSource = ds
GridView1.PageSize = 15
GridView1.AllowPaging = True
GridView1.DataBind()
Needless there is a SQL statement not shown that creates 5 columns of data. Here are a couple of other events with some code:
Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
GridView1.DataSource = ds
GridView1.DataBind()
End Sub
Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing
Response.Write(GridView1.Columns.Count)
End Sub
OK a couple of things - when the column.count is written on the page, the answer is 0. Yes, I cannot access data in any particular column because the control is stating it has no columns! I have not set up any columns in the column editor, just have the autogenerate columns checkbox checked. The five columns of data display when I run the page, but if I try any code to get to a piece of data, I cannot.
Second thing, when I click Next (or any navigation) to page, the GridView disappears! I had read to rebind in the PageIndexChanging event. I have that code in there, but no success.
More - if I try to add a Template column, I get an error telling me to turn callbacks off. I don't see any way to do this.
What is going on!??
I am trying to get paging to work on a GridView control, also I cannot access any particular piece of data. First some code:
da.TableMappings.Add("Deals", "Deals1")
dc = New SqlCommand(ssql, conn)
da.SelectCommand = dc
da.Fill(ds, ssql)
GridView1.DataSource = ds
GridView1.PageSize = 15
GridView1.AllowPaging = True
GridView1.DataBind()
Needless there is a SQL statement not shown that creates 5 columns of data. Here are a couple of other events with some code:
Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
GridView1.DataSource = ds
GridView1.DataBind()
End Sub
Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing
Response.Write(GridView1.Columns.Count)
End Sub
OK a couple of things - when the column.count is written on the page, the answer is 0. Yes, I cannot access data in any particular column because the control is stating it has no columns! I have not set up any columns in the column editor, just have the autogenerate columns checkbox checked. The five columns of data display when I run the page, but if I try any code to get to a piece of data, I cannot.
Second thing, when I click Next (or any navigation) to page, the GridView disappears! I had read to rebind in the PageIndexChanging event. I have that code in there, but no success.
More - if I try to add a Template column, I get an error telling me to turn callbacks off. I don't see any way to do this.
What is going on!??