Hi,
We are dynamically building radgrids in PageLoad and adding an event handler for needDataSource as follows
Dim NewGrid As New RadGrid
NewGrid.DataSource = dv
NewGrid.Skin = "Web20"
NewGrid.ID = "rg_" & FormID.ToString
NewGrid.AllowFilteringByColumn = True
NewGrid.AllowSorting = True
NewGrid.AllowPaging = True
AddHandler NewGrid.NeedDataSource, AddressOf Me.grid_NeedDataSource
NewGrid.DataBind()
On any sort or filter operations on the resulting grid, the grid never calls the grid_NeedDataSource which is as follows
Protected Sub grid_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs)
Dim FormID As Integer
Dim dv As New DataView
Try
Dim rg As RadGrid = CType(source, Telerik.Web.UI.RadGrid)
If rg IsNot Nothing Then
FormID = CInt(rg.ID.ToString.Remove(0, 3))
dv = CreateDataTable(FormID)
rg.DataSource = dv
End If
Catch ex As Exception
End Try
End Sub
I assume this has to do with the page and control life cycle - I have tried creating the grids in PageLoad (not in an IsPostback test) and this simply reloads the grid but without sort/filtering. Can anyone tell me what I am doing wrong here?
We are dynamically building radgrids in PageLoad and adding an event handler for needDataSource as follows
Dim NewGrid As New RadGrid
NewGrid.DataSource = dv
NewGrid.Skin = "Web20"
NewGrid.ID = "rg_" & FormID.ToString
NewGrid.AllowFilteringByColumn = True
NewGrid.AllowSorting = True
NewGrid.AllowPaging = True
AddHandler NewGrid.NeedDataSource, AddressOf Me.grid_NeedDataSource
NewGrid.DataBind()
On any sort or filter operations on the resulting grid, the grid never calls the grid_NeedDataSource which is as follows
Protected Sub grid_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs)
Dim FormID As Integer
Dim dv As New DataView
Try
Dim rg As RadGrid = CType(source, Telerik.Web.UI.RadGrid)
If rg IsNot Nothing Then
FormID = CInt(rg.ID.ToString.Remove(0, 3))
dv = CreateDataTable(FormID)
rg.DataSource = dv
End If
Catch ex As Exception
End Try
End Sub
I assume this has to do with the page and control life cycle - I have tried creating the grids in PageLoad (not in an IsPostback test) and this simply reloads the grid but without sort/filtering. Can anyone tell me what I am doing wrong here?