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

[Solved] How to keep the grid staying in insert mode

2 Answers 311 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Edwin
Top achievements
Rank 1
Edwin asked on 13 Jul 2009, 10:07 AM
Hi
Currently, I am using InPlace edit mode to let user adding new records in RadGrid.  Users need to click "Add" in the CommandItemTemplate to show the controls in the EditItemTemplate.  AFter user click Update, the record is added and the EditItemTemplate is closed.  Users need to click "Add" again to add the second record.  How can I make the Grid remain in "Insert Mode" after adding a new record?

I have tried 

    protected void radLines_InsertCommand(object source, GridCommandEventArgs e)
    {
            /* codes to add record */
            RadGrid grid = source as RadGrid;
            grid.MasterTableView.IsItemInserted = true;
            grid.Rebind();
    }

but the EditItemTemplate is still closed.

Regards
Edwin

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 13 Jul 2009, 10:56 AM
Hello Edwin,

After inserting an item, inorder to keep the InsertForm open you can use the following code snippet.

c#:
protected void radLines_InsertCommand(object source, GridCommandEventArgs e) 
    { 
            /* codes to add record */   
          
            e.canceled=true;  
    } 

-Princy.
0
Edwin
Top achievements
Rank 1
answered on 13 Jul 2009, 11:53 AM
Hi Princy
Thanks for your advice.  It works but I need to add code to rebind the grid so that the added record is displayed.  To complete, here is the code.

protected void radLines_InsertCommand(object source, GridCommandEventArgs e)  
{  
  /* codes to add record */ 
  RadGrid grid = source as RadGrid;  
  grid.Rebind();  
  e.Canceled = true;  

Edwin
Tags
Grid
Asked by
Edwin
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Edwin
Top achievements
Rank 1
Share this question
or