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

Problem in Sorting in Radgrid

1 Answer 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Coolbudy
Top achievements
Rank 1
Coolbudy asked on 21 Nov 2012, 09:16 AM
I write the code for radgrid sorting event
if ("FirstName".Equals(e.CommandArgument))
        {
            switch (e.OldSortOrder)
            {
                case GridSortOrder.None:
                  
              
                    RadGrid1.DataSource = objclass.GetData();
                    RadGrid1.Rebind();
                    break;
           
            }
        }
error i facing
There was a problem extracting DataKeyValues from the DataSource. Please ensure that DataKeyNames are specified correctly and all fields specified exist in the DataSource.

how can i solve it......................

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 26 Nov 2012, 08:34 AM
Hello,

Please note that modifying the grid datasource using this approach is not supported. The grid is automatically rebinded on a Sort command, therefore you need to use e.Canceled=true if you want to prevent the sort operation.

Generally, performing complex grid operations such as Inserting, Deleting, Updating, Hierarchy relations, Grouping, Paging, Sorting, Filtering require accommodating appropriate database operations.  Therefore, instead of Simple Databinding, we strongly recommend the use of more advanced databinding methods, which automatically handle the aforementioned functions:
Declarative DataSource
Advanced Data Binding

I hope this will prove helpful.

Kind regards,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Coolbudy
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or