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

RadGrid state on sorting with simple data bound

1 Answer 171 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paresh
Top achievements
Rank 1
Paresh asked on 26 Mar 2014, 08:03 AM
Hi,
I was checking Telerik UI for ASP.NET AJAX Q1 2014 trial version for feasibility.

I was testing RadGrid with my existing code but its behavior is strange compared to MS GridView with Simple-Databinding.

In my existing code, i am not assigning datasource and not binding grid on particular condition.
MS GridWorks keeps data as it is but RadGrid clears data.
I checked that with e.Canceled = True it preserves state.

the issue occurs when  if at the time of data fetching any error occurs. it clears previous data. in MS grid it keeps data from viewstate.

Grid should clear data only when .DataBind() or Rebind() called.
 
Is there any property or method to make its behavior equivalent.?

Please find sample code at https://mega.co.nz/#!YYtFCK5Q!PV5XczgbAeyLApV8UtO72O9BBbY6jKl2TJ984703eEo

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 28 Mar 2014, 02:34 PM
Hi Paresh,

The behavior you are observing in the sample project is expected as the data source for RadGrid is not set after sorting the second column. Note that when using simple data-binding you must set the DataSource and rebind the grid after every operation (sorting, paging, etc.). The approach is also illustrated in this online demo.

In order for the functionality to work in the sample you need to remove the 'Exit Sub' line from the SortCommand handler. This would ensure that the DataSource is set and the RadGrid is data-bound.

Please note that simple data-binding for RadGrid, as the name implies, is recommended to be used in simple scenarios where operations like filtering, grouping, paging, sorting are not necessary. If you have more complex scenario you should consider using advanced data binding by either handling the NeedDataSource event or using declarative data-source.


Regards,
Viktor Tachev
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
Grid
Asked by
Paresh
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or