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

GridView Row Add

1 Answer 69 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Thi Han
Top achievements
Rank 1
Thi Han asked on 12 Jan 2012, 06:15 AM
i want  to know  how to add the rows added by the users to be added on the top
and also want to know how to add the rows that added by programatically to be added on the top.

i use the bound mode.i bind List<> to the "gridview.DataSource".
 
 

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 16 Jan 2012, 01:58 PM
Hello Thi Han,

Thank you for the additional details.

I would suggest using BindingList instead of a List, since the BindingList implements the IBindingList interface internally, which allows the grid to get notified for changes in the list. The approach for the first scenario is to handle the UserAddedRow event of RadGridView, where you can get the newly added row, save its DataBoundItem (the custom object) to a variable, then remove the row from the grid Rows collection and insert the saved object in your BindingList at position 0. The approach with the programatically adding rows is to simply create the custom object and insert it at position 0 in your BindingList.

Attached you can find a sample application.

I hope that you find this information helpful.

A bit off topic, I would like to mention that it is possible to write multiple posts in one thread, so you do not need to open a new thread for each post, i.e. you could post the additional details straight in the previous thread that you have opened.
 
Regards,
Stefan
the Telerik team

SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

Tags
GridView
Asked by
Thi Han
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or