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

Close Edit Form when opening Insert Form

2 Answers 158 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 11 Aug 2010, 12:45 PM
I am using a custom UserControl as the EditForm of a RadGrid.

The way I have it set-up, it is possible to open both an EditForm and an InsertForm at the same time - as these both use the same user control, my validation groups are clashing, and stopping the page from working.

Is it possible to set up the <telerik:RadGrid> control up so that as soon as I click 'Insert Record' the Edit Form closes, and vice-versa, as soon as I Edit a Record, the Insert Record form closes?

Thanks
DA

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 11 Aug 2010, 12:48 PM
Hello,

The folowing code will help you in achieving the requred.

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


Thanks,
Princy.
0
Dave
Top achievements
Rank 1
answered on 13 Aug 2010, 02:35 PM
Hi,

Thanks for your reply. That works a treat when the InsertForm and EditForm are both at the same level.

Is there a way to achieve the same result when InsertForm and EditForm are in different levels (e.g. one in the MasterTable and the other one in a DetailTable)?

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