G
Guest
Hi,
I am trying to figure out why my datagrid has stopped firing the page and
sort commands.
Scenario:
I originally had template columns in my datagrid and had set up custom
bi-directional sorting as well as paging of the datagrid records.
It worked fine. Then I decided to be clever on an update and thought I'd
create the template columns programmatically - which I have done.
Problem is, the paging command and sort commands have stopped firing.
Please could someone give me advice on how to solve the problem.
Here is my set up:
Datagrid properties:
OnSortCommand="DataGrid1_Sort"
OnPageIndexChanged="DataGrid1_Page"
Sort Command:
Sub DataGrid1_Sort(ByVal sender As Object, ByVal e As
DataGridSortCommandEventArgs) Handles DataGrid1.SortCommand
' Check to see if the column we clicked on is the current column
defined
' in the sortCriteria property.
If Me.sortCriteria = e.SortExpression Then
If Me.sortDir = "desc" Then
Me.sortDir = "asc"
Else
Me.sortDir = "desc"
End If
End If
' Assign the column clicked to the sortCriteria property
Me.sortCriteria = e.SortExpression
' Now call the procedure to re-display the Data Grid
DisplayGrid()
End Sub
Page COmmand:
Sub DataGrid1_Page(ByVal sender As Object, ByVal e As
DataGridPageChangedEventArgs) Handles DataGrid1.PageIndexChanged
DataGrid1.CurrentPageIndex = e.NewPageIndex
DisplayGrid()
End Sub
Example of template column:
Dim tDate As BoundColumn = New BoundColumn
With tDate
.HeaderText = "Date of B'Cast"
.DataField = "Coverage_Date"
.SortExpression = "Coverage_Date"
.DataFormatString = "{0:d}"
.HeaderStyle.Width = Unit.Point(60)
.HeaderStyle.VerticalAlign = VerticalAlign.Top
End With
DataGrid1.Columns.AddAt(ColIndex, tDate)
thanks,
KS
I am trying to figure out why my datagrid has stopped firing the page and
sort commands.
Scenario:
I originally had template columns in my datagrid and had set up custom
bi-directional sorting as well as paging of the datagrid records.
It worked fine. Then I decided to be clever on an update and thought I'd
create the template columns programmatically - which I have done.
Problem is, the paging command and sort commands have stopped firing.
Please could someone give me advice on how to solve the problem.
Here is my set up:
Datagrid properties:
OnSortCommand="DataGrid1_Sort"
OnPageIndexChanged="DataGrid1_Page"
Sort Command:
Sub DataGrid1_Sort(ByVal sender As Object, ByVal e As
DataGridSortCommandEventArgs) Handles DataGrid1.SortCommand
' Check to see if the column we clicked on is the current column
defined
' in the sortCriteria property.
If Me.sortCriteria = e.SortExpression Then
If Me.sortDir = "desc" Then
Me.sortDir = "asc"
Else
Me.sortDir = "desc"
End If
End If
' Assign the column clicked to the sortCriteria property
Me.sortCriteria = e.SortExpression
' Now call the procedure to re-display the Data Grid
DisplayGrid()
End Sub
Page COmmand:
Sub DataGrid1_Page(ByVal sender As Object, ByVal e As
DataGridPageChangedEventArgs) Handles DataGrid1.PageIndexChanged
DataGrid1.CurrentPageIndex = e.NewPageIndex
DisplayGrid()
End Sub
Example of template column:
Dim tDate As BoundColumn = New BoundColumn
With tDate
.HeaderText = "Date of B'Cast"
.DataField = "Coverage_Date"
.SortExpression = "Coverage_Date"
.DataFormatString = "{0:d}"
.HeaderStyle.Width = Unit.Point(60)
.HeaderStyle.VerticalAlign = VerticalAlign.Top
End With
DataGrid1.Columns.AddAt(ColIndex, tDate)
thanks,
KS