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

Different edit forms on edit and insert

1 Answer 43 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tina
Top achievements
Rank 1
Tina asked on 08 May 2012, 03:26 PM
How to show different user controls on edit and insert operation?

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 08 May 2012, 03:35 PM
Hi Tina,

Try the following  code snippet to get different usercontrol on edit and insert operation.

C#:
protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
    if (e.CommandName == RadGrid.InitInsertCommandName)
    {
        e.Canceled = true;
        RadGrid1.EditIndexes.Clear();
 
        e.Item.OwnerTableView.EditFormSettings.UserControlName = "MyInsertFormUserControl.ascx";
        e.Item.OwnerTableView.InsertItem();
    }
    else if (e.CommandName == RadGrid.EditCommandName)
    {
        e.Item.OwnerTableView.IsItemInserted = false;
        e.Item.OwnerTableView.EditFormSettings.UserControlName = "EmployeeDetailsVB.ascx";
    }
}

Please take a look into this document.

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