This is a migrated thread and some comments may be shown as answers.

The rad grid pagination and sorting works only on the 1st click

5 Answers 117 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Gayatri
Top achievements
Rank 1
Gayatri asked on 14 Apr 2014, 10:58 AM
I am creating the entire grid on the server side and I have made allowpaging=true and allowsorting=true. But the paging and sorting works only on the 1st click. Even the inbuilt filter works only for the 1st time and afterwards it doesn't work.  Viewstate of the grid is set to true. IF I mark the viewstate as false ,then the pagination and other inbuilt functionality doesn't work even for once. I tried to set the event "OnNeedDataSource" but my rad grid doesn't have the event itself.

The product version of teh telerik.web.UI dll is- 2012.2.607.35

Please let me know what am I doing wrong?

5 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 14 Apr 2014, 02:18 PM
Hi Gayatri,

I supposed that the grid is populated through simple data binding calling DataBind() and this leads to the described behavior. Keep in mind that if you choose simple data-binding, you will need to assign data-source and rebind the grid after each operation (paging, sorting, filtering, etc.) - this copies exactly MS DataGrid behavior.     

Therefore, I would recommend you subscribe to NeedDataSource event handler prepare the data source (list of objects) for Telerik RadGrid and assign it to the grid's DataSource property as it is shown in this online example:
http://demos.telerik.com/aspnet-ajax/grid/examples/data-binding/simple-vs-advanced/defaultcs.aspx

Note that OnNeedDataSource event is available in 2012.2.607.35 version of Telerik UI controls for ASP.NET AJAX. Can you make sure that you have reference to Telerik.Web.UI.dll in your project?

Regards,
Pavlina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Gayatri
Top achievements
Rank 1
answered on 15 Apr 2014, 03:49 AM
I am binding the grid after each operation, but it never reflects the right page. Moreover I am referencing the dll mentioned by you, still I do not get the ""OnNeedDataSource" event for the rad grid. That puzzles me even more.
0
Pavlina
Telerik team
answered on 18 Apr 2014, 02:14 AM
Hello,

Could you please share the problematic code with us, so we can test it locally and advice you further?

Regards,
Pavlina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Gayatri
Top achievements
Rank 1
answered on 21 Apr 2014, 04:56 AM
As I mentioned earlier I am not able use the "OnNeedDataSource" event, as I do not get this event with the dll I am using. Ideally I should get the event ,but surprisingly the dll does't have the event.  "viewstate" property for the grid is set yo true. If I set it to false , then the inbuilt properties do not work at at, not even on the 1st click. The grid is created on run time(Server side). There is no aspx page code for it. Please suggest what do I need to do?
Below code is what I am calling on pageindexchanged-
Protected Sub _gridControlRadGrid_PageIndexChanged(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridPageChangedEventArgs)
            LoadDataForRadGrid()
        End Sub

Private Sub LoadDataForRadGrid()
            Try


                Me._gridControlRadGrid.DataSource = ReportDataView
                _gridControlRadGrid.CurrentPageIndex = _gridControlRadGrid.MasterTableView.CurrentPageIndex
                '_gridControlRadGrid.Rebind()
                _gridControlRadGrid.MasterTableView.VirtualItemCount = ReportDataView.Count

                Me._gridControlRadGrid.DataBind()
            Catch ex As Exception

            End Try
        End Sub
0
Pavlina
Telerik team
answered on 23 Apr 2014, 03:57 PM
Hello,

I have tested the described scenario using the 2012.2.607 version of Telerik UI controls and NeedDataSource event fires as expected. Give it a try and see what is the difference on your end.

Regards,
Pavlina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
Gayatri
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Gayatri
Top achievements
Rank 1
Share this question
or