Hey guys, did a search of the forums and haven't found exactly what I needed so I figured I would ask here.
I am using databinding to hydrate my radgrid and everything was working fine. The problem started when I wanted to sort and filter the grid.
I realized quickly the need for a NeedDataSource sub and put it to use. However when I attempted to clean up the code and put my logic in its own sub, I run into problems. If I throw the code from the hydrategrid sub into the NeedDataSource sub, as well as the button click sub the page sorts fine.
If I break the code into the HydrateGrid sub then when I hit the sort button or apply a filter, the grid shows empty.
I have simplified the HydrateGrid sub but here is my code:
I am using databinding to hydrate my radgrid and everything was working fine. The problem started when I wanted to sort and filter the grid.
I realized quickly the need for a NeedDataSource sub and put it to use. However when I attempted to clean up the code and put my logic in its own sub, I run into problems. If I throw the code from the hydrategrid sub into the NeedDataSource sub, as well as the button click sub the page sorts fine.
If I break the code into the HydrateGrid sub then when I hit the sort button or apply a filter, the grid shows empty.
I have simplified the HydrateGrid sub but here is my code:
Protected Sub HydrateGrid(ByVal bindit As Boolean)TryradgrdResults.DataSource = searchvalues.Fetch(gd) If bindit = True Then radgrdResults.DataBind() End If Catch ex As Exception Throw ex End Try End SubProtected Sub searchButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles searchButton.Click Try ' hydrate grid with data HydrateGrid(True) Catch ex As Exception Throw ex End Try End Sub Protected Sub radgrdResults_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Try ' Hydrate grid with data but don't bind HydrateGrid(False) Catch ex As Exception Throw ex End Try End Sub