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

[Solved] Edit a item and Insert a new item at the same time

2 Answers 114 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John Sornea
Top achievements
Rank 1
John Sornea asked on 14 Jan 2010, 03:36 PM
Hello Telerik Team,

I have a grid that has 3 pages.
I click the edit command on one item in the first page, the edit form opens.
I click the insert new item command , and the new item form opens, but the edit row now its not the same row I previously clicked to edit, but it is the row from the last page (page 3 in my case) which has the same relative index with the row I clicked first to edit.

For example, if i click edit on the first row, and then insert new row, the edited item will become the first row from the last page.

How can I solve this problem?

I am using as a datasource a List of objects which is bound on the NeedDataSource event.

2 Answers, 1 is accepted

Sort by
0
John Sornea
Top achievements
Rank 1
answered on 14 Jan 2010, 04:15 PM
OK, I managed to solve this issue by setting the MasterTableView.InsertItemPageIndexAction to ShowItemOnCurrentPage.

Still, I think it is wrong for the row which is in Edit mode to be changed automatically with another row  which is on another page when insert new row is fired, no matter what the grid settings are.
0
Yavor
Telerik team
answered on 20 Jan 2010, 06:51 AM
Hello John,

If you set the MasterTableView.InsertItemPageIndexAction to ShowItemOnCurrentPage, the page would not be changed, hence the logic will be preserved. Other than this, the reason for setting the other item in edit mode is that the item index of the edited item is stored for the initial item. When the page is altered internally, the item with the same index, but on another page is set in edit mode. However, with the setting mentioned above, this behavior can be avoided.

Kind regards,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
John Sornea
Top achievements
Rank 1
Answers by
John Sornea
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or