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

sorting Radgrid with template column with textboxes

3 Answers 108 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Prathibarani
Top achievements
Rank 1
Prathibarani asked on 22 Mar 2013, 09:49 PM
Hi,

I am new to Telerik RadControl suite (2013 Q1) and testing RadGrid control. I am surprised to find that sorting on client side on Radgrid is not that simple. In some post it is mentioned that I have to do this:

call the web service/page method/ URL that provides your data when you need to sort. RadGrid then expects the sorted data to be returned in the response. If you need to simulate this approach entirely on the client-side, you can hook to the client-side OnCommand event, check for the Sort command, cancel the command to prevent default behavior, sort the data programmatically with javascript and pass the sorted result back to the grid using RadGrid.get_masterTableView().set_dataSource().

If we are going with server side:
I have to code in RadGrid1_SortCommand event and rebind the grid. Our requirement has that we use templated column with textboxes and let user enter data. At any point of time, user can sort. Say suppose I have 10 rows, user entered values into text boxes of 2 rows. Then he clicked on some column header text. How do we retain text box values if we rebind the grid. Does it automatically uses viewstate to set back templated column with textboxes and value.

If anyone has any examples, please let me know.
Thanks,
Prathiba.

3 Answers, 1 is accepted

Sort by
0
Prathibarani
Top achievements
Rank 1
answered on 25 Mar 2013, 06:37 PM
any one, please look into this issue.

Thanks,
Prathiba
0
Andrey
Telerik team
answered on 27 Mar 2013, 03:29 PM
Hello,

You could check this help topic for more information on how to sort template columns. As for the second question you should manually retain the entered value when the user sort the column. You could use the information from this help topic to achieve this result. Although it is for checkbox it could be used for TextBox controls as well.

Regards,
Andrey
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.
0
Sami
Top achievements
Rank 1
answered on 15 Jul 2014, 10:55 PM
hi;
Simply type the field name in the sort expression property of the template column.
Tags
Grid
Asked by
Prathibarani
Top achievements
Rank 1
Answers by
Prathibarani
Top achievements
Rank 1
Andrey
Telerik team
Sami
Top achievements
Rank 1
Share this question
or