Hello!
I have been EVERYWHERE without a solid answer- not sure what is going on. I have a Datagrid, EnableViewState="false"- I want to use paging. I have seen articles everywhere on how to make this work. It seems like it works locally, when I put it out on a development server, the first page loads, when I click on say, page 5 the page is blank! I have the grid binding too on PageIndexChanged; not sure what is wrong. Here is some code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not ViewState("CurrentPageIndex") Is Nothing Then
DataGrid1.CurrentPageIndex = ViewState("CurrentPageIndex")
End If
BindGrid()
End Sub
Private Sub BindGrid()
Dim cnn As SqlConnection
Dim da As SqlDataAdapter
Dim ds As New DataSet
cnn = New SqlConnection(ConfigurationSettings.AppSettings().Item("ConnectionString"))
da = New SqlDataAdapter("select Appropriation, PAR, Username, ProjectName , 'ViewInfo.aspx?APPID=' +Appropriation AS URL from tblAppropriation", cnn)
da.Fill(ds, "tblAppropriation")
DataGrid1.DataSource = ds.Tables("tblAppropriation").DefaultView
DataGrid1.DataSource = ds
DataGrid1.DataMember = "tblAppropriation"
DataGrid1.DataBind()
End Sub
Sub Datagrid1_PageIndexChanged(ByVal s As Object, ByVal e As DataGridPageChangedEventArgs) Handles DataGrid1.PageIndexChanged
DataGrid1.CurrentPageIndex = e.NewPageIndex
ViewState("CurrentPageIndex") = e.NewPageIndex
BindGrid()
End Sub
Not sure why my page is blank when I want to navigate to another page- HELP!
Thanks,
Lisa
I have been EVERYWHERE without a solid answer- not sure what is going on. I have a Datagrid, EnableViewState="false"- I want to use paging. I have seen articles everywhere on how to make this work. It seems like it works locally, when I put it out on a development server, the first page loads, when I click on say, page 5 the page is blank! I have the grid binding too on PageIndexChanged; not sure what is wrong. Here is some code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not ViewState("CurrentPageIndex") Is Nothing Then
DataGrid1.CurrentPageIndex = ViewState("CurrentPageIndex")
End If
BindGrid()
End Sub
Private Sub BindGrid()
Dim cnn As SqlConnection
Dim da As SqlDataAdapter
Dim ds As New DataSet
cnn = New SqlConnection(ConfigurationSettings.AppSettings().Item("ConnectionString"))
da = New SqlDataAdapter("select Appropriation, PAR, Username, ProjectName , 'ViewInfo.aspx?APPID=' +Appropriation AS URL from tblAppropriation", cnn)
da.Fill(ds, "tblAppropriation")
DataGrid1.DataSource = ds.Tables("tblAppropriation").DefaultView
DataGrid1.DataSource = ds
DataGrid1.DataMember = "tblAppropriation"
DataGrid1.DataBind()
End Sub
Sub Datagrid1_PageIndexChanged(ByVal s As Object, ByVal e As DataGridPageChangedEventArgs) Handles DataGrid1.PageIndexChanged
DataGrid1.CurrentPageIndex = e.NewPageIndex
ViewState("CurrentPageIndex") = e.NewPageIndex
BindGrid()
End Sub
Not sure why my page is blank when I want to navigate to another page- HELP!
Thanks,
Lisa