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

Stop Edit and Insert from displaying at the same time

4 Answers 199 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Justin McMillen
Top achievements
Rank 1
Justin McMillen asked on 07 Jan 2010, 08:35 PM
I have a RadGrid that is bound to an ObjectDataSource.  The grid has automatic insert, update and delete set to "true".  How can I get the grid to cancel out of edit mode when I click Insert?  I would also like to know how to cancel out of insert mode when I click to edit a row.

Thanks.

4 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 08 Jan 2010, 04:36 AM
Hello Justin,

Add the following code snippet in order hide editform when clicking insert and vice versa.

CS:
 
    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(); 
        } 
    } 

-Shinu.
0
Justin McMillen
Top achievements
Rank 1
answered on 08 Jan 2010, 05:07 PM
Hi Shinu,
  Thanks for the quick response.  This works well.
0
Duy
Top achievements
Rank 1
answered on 21 Jun 2013, 04:16 PM
it worked for regular grid but how do you do this for grid with hierarchy
0
Duy
Top achievements
Rank 1
answered on 21 Jun 2013, 04:37 PM
do below in RadGrid1_ItemCommand 

RadGrid1.MasterTableView.DetailTables(0).IsItemInserted = False
                TryCast(RadGrid1.MasterTableView.Items(0), GridDataItem).ChildItem.NestedTableViews(0).IsItemInserted = False
                TryCast(RadGrid1.MasterTableView.Items(0), GridDataItem).ChildItem.NestedTableViews(0).Rebind()
Tags
Grid
Asked by
Justin McMillen
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Justin McMillen
Top achievements
Rank 1
Duy
Top achievements
Rank 1
Share this question
or