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

Turn off insertmode on edit?

1 Answer 105 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Hong
Top achievements
Rank 1
Hong asked on 03 Jan 2011, 08:28 PM
I am working on a radgrid set to AllowMultiRowEdit="false".
When I click on Edit for a data row, data row goes into Edit mode.
If I clicked on another data row, that data row then goes into Edit mode, and the previous data row is no longer in Edit mode (as should happen).
If I click on 'Add New Row', any data row previously in Edit mode is no longer in Edit mode (as should happen, and that is what I want to see as well).

NOW: with an Insert row on display, if I click 'Edit' on a data row, I now have an Insert row AND a data row in Edit mode.
What I would prefer is for the Insert row to disappear.

Is there a way to do this?

I believe there is a way to do this with NewEditIndex property of ASP.NET grid (or list), but I scoured the radgrid and could not find a property via which to achieve this.

Thank you in advance for input.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 05 Jan 2011, 06:53 AM
Hello,


The following code is going to help you to close the insert from when putting row in edit mode and vice versa.

code:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
{
    if (e.CommandName == RadGrid.EditCommandName)
    {
        RadGrid1.MasterTableView.IsItemInserted = false;
    }
    if (e.CommandName == RadGrid.InitInsertCommandName)
    {
        RadGrid1.MasterTableView.ClearEditItems();
    }
}

Also refer the documentation regarding this:
Switching the Insert/Updade/Regular Modes


-Shinu.
Tags
Grid
Asked by
Hong
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or