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

Grid - Add and Edit at same time

2 Answers 118 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Armando
Top achievements
Rank 1
Armando asked on 23 Dec 2010, 03:18 PM
Hi.

I'm using a radgridview to insert and edit item. i am using the same user control to edit and insert items

i want show only one control at the same time. for example: if the user touch "insert item"; show the user control to insert item. If the insert control is showing and the user do a click in edit. the user control to insert must be hdie and show the user control to edit.

how can i do this?. 

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Dec 2010, 05:57 AM
Hello Armando,

You can try the following code snippet in ItemCommandEvent to show edit/insert control at a time.

C#:
protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
   {
      RadGrid grid = (sender as RadGrid);
       if (e.CommandName == RadGrid.InitInsertCommandName)
       {
           if (grid.EditItems.Count > 0)
           {
               grid.MasterTableView.ClearEditItems();
           }
       }
       if (e.CommandName == RadGrid.EditCommandName)
       {
           e.Item.OwnerTableView.IsItemInserted = false;
       }      
    }

Please refer  the documentation for more on this.
Switching the Insert/Updade/Regular Modes

Thanks,
Shinu.
0
Armando
Top achievements
Rank 1
answered on 05 Jan 2011, 04:29 AM
Thank you very much for helping me. I use the solution they gave meand it works.
Tags
Grid
Asked by
Armando
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Armando
Top achievements
Rank 1
Share this question
or