F
Frank Walsh
Hi,
I am experiencing a problem with datagrid paging when I attempt to disable
AutoGenerateColumns. My event handler for the pager will not fire, thus the
paging does not occur. I really don't want to have to do 2 sql calls
everytime someone wants to page which I have found will work ( removing the
BindData only if not postback in the pageload function). Can anyone tell me
if there is something I'm doing wrong here?
Things I have tried to fix this problem:
1.Enable and disabled Viewstate on the Datagrid - No Effect
2.Override the LoadViewState Sub and called DefineDataGrid in it - No Effect
3. Bound and Not Bound at the conclusion of DefineDataGrid Function - No
Effect
4. Called my define datagrid function in page load explicitely independent
of postback or not - No Effect
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
BindData()
End If
End Sub
Sub DefineDataGrid()
DataGrid1.AllowPaging = True
DataGrid1.PagerStyle.Mode = PagerMode.NumericPages
DataGrid1.PageSize = 25
Dim DataGridCol As BoundColumn
DataGridCol = New BoundColumn
With DataGridCol
.HeaderText = "Report #"
.. DataField = "ReportNum"
End With
DataGrid1.Columns.Add(DataGridCol)
Me.DataGrid1.DataBind()
End Sub
Sub BindData()
DefineDataGrid()
STANDARD SQL STUFF HERE
End Sub
Sub PageIndexChanged_Click(ByVal sender As Object, ByVal e As
DataGridPageChangedEventArgs) Handles DataGrid1.PageIndexChanged
DataGrid1.CurrentPageIndex = e.NewPageIndex
BindData()
End Sub
I am experiencing a problem with datagrid paging when I attempt to disable
AutoGenerateColumns. My event handler for the pager will not fire, thus the
paging does not occur. I really don't want to have to do 2 sql calls
everytime someone wants to page which I have found will work ( removing the
BindData only if not postback in the pageload function). Can anyone tell me
if there is something I'm doing wrong here?
Things I have tried to fix this problem:
1.Enable and disabled Viewstate on the Datagrid - No Effect
2.Override the LoadViewState Sub and called DefineDataGrid in it - No Effect
3. Bound and Not Bound at the conclusion of DefineDataGrid Function - No
Effect
4. Called my define datagrid function in page load explicitely independent
of postback or not - No Effect
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
BindData()
End If
End Sub
Sub DefineDataGrid()
DataGrid1.AllowPaging = True
DataGrid1.PagerStyle.Mode = PagerMode.NumericPages
DataGrid1.PageSize = 25
Dim DataGridCol As BoundColumn
DataGridCol = New BoundColumn
With DataGridCol
.HeaderText = "Report #"
.. DataField = "ReportNum"
End With
DataGrid1.Columns.Add(DataGridCol)
Me.DataGrid1.DataBind()
End Sub
Sub BindData()
DefineDataGrid()
STANDARD SQL STUFF HERE
End Sub
Sub PageIndexChanged_Click(ByVal sender As Object, ByVal e As
DataGridPageChangedEventArgs) Handles DataGrid1.PageIndexChanged
DataGrid1.CurrentPageIndex = e.NewPageIndex
BindData()
End Sub