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

user conterols

1 Answer 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sigma
Top achievements
Rank 1
Sigma asked on 06 Aug 2012, 01:10 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 06 Aug 2012, 01:19 PM
Hi,

Try the following code snippet to show different UserControl on insert and edit.

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 help documentation.

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