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

Adding new row when in edit mode causes to go out of edit mode

3 Answers 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dom
Top achievements
Rank 1
Dom asked on 10 Jan 2012, 09:51 PM
I have a grid with detail table. When I click Edit on a detail table, all rows go into edit mode and everything is nice and peachy. In edit mode, I also display a button for user to add a copy of the item with some values predefined. The problem is when add button is clicked and new item is created in datasource and then OwnerTableView is data bound (so that new item appears in the grid, sorted) in the callback my command items go into non-edit mode even though the grid still appears in edit mode. Any ideas what might be causing that?

Dom

3 Answers, 1 is accepted

Sort by
0
Dom
Top achievements
Rank 1
answered on 10 Jan 2012, 11:39 PM
Let me rephrase my post.

What I'm trying to do is "mass edit" of a detail table. I'm using EditMode = "InPlace" and everything was working fine until I was asked to add ability to add a new row to a detail table. In test scenario I'm doing, it creates a new row that's editable (it's done in the code so I'm not even using InsertItemTemplate), but then another row goes out of the edit mode. Can any one post an example how to add a new row to a detail table that has all rows in edit mode? I've tried going through all GridDataItems and setting Edit to true before data binding but it doesn't work.
0
Antonio Stoilkov
Telerik team
answered on 11 Jan 2012, 05:00 PM
Hello Dominik,

RadGrid multi-item editing is not enabled by default. You could enable edit mode for multiple items by setting RadGrid AllowMultiRowEdit property to true. Additionally, you could go through the demo below and check the Allow multi-row edit to observe the functionality.

Greetings,
Antonio Stoilkov
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
Dom
Top achievements
Rank 1
answered on 11 Jan 2012, 05:06 PM
Thanks, but my problem was that I didn't bind detail table before setting all items to edit mode. I figured it out this morning after long day yesterday. Now everything works as it should.

case AddValueByClassCommand:
	UpdatePinView(sender, e, false);
	AddClassCodeValue(sender, e);
	e.Item.OwnerTableView.DataBind(); <-- I was missing this in my OnItemCommand callback.
	SetGridTableEditable(e, true);
	e.Item.OwnerTableView.DataBind();
	break;
Tags
Grid
Asked by
Dom
Top achievements
Rank 1
Answers by
Dom
Top achievements
Rank 1
Antonio Stoilkov
Telerik team
Share this question
or