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

Queries on RadGrid

1 Answer 26 Views
Grid
This is a migrated thread and some comments may be shown as answers.
veluswamy vijayakumar
Top achievements
Rank 1
veluswamy vijayakumar asked on 19 Jul 2010, 01:42 PM

Hi Telerik,

Have a few queries on the capability  of the RadGrid in the following scenarios

1. Can we restrict the user to do either Update or Insert. That is when a new row is added for Insert , the user cannot edit another row and vice versa?

2. Can we add multiple new rows at the same time instead of one by one?

Regards



1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 20 Jul 2010, 06:59 AM
Hello Veluswami,

For the first scenario, you can either try the following code snippet to cancel one operation when performing other. Or you can refer the following forum link which shows how to hide the insert form when clicking Edit Button and vice versa.
Reg: Add new Record and Edit record in the RadGrid

C#:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
    {
       if (e.CommandName == RadGrid.EditCommandName)
        {
            if (RadGrid1.MasterTableView.IsItemInserted)
            {
                e.Canceled = true;
            }
        }
       if (e.CommandName == RadGrid.InitInsertCommandName)
       {
           if (RadGrid1.EditItems.Count > 0)
           {
               e.Canceled = true;
           }
       }
     }

I am not sure about showing multiple rows for insert at the same time. But you can keep the pop-insert form after insertion by adding the code whcih is shown below.

C#:
protected void RadGrid1_ItemInserted(object source, GridInsertedEventArgs e)
   {
       e.KeepInInsertMode = true;
   }

Hope this helps you,
Princy.
Tags
Grid
Asked by
veluswamy vijayakumar
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or