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

usercontrol in insert and edit

1 Answer 50 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tina
Top achievements
Rank 1
Tina asked on 18 Apr 2012, 01:47 PM
How to show different user controls in edit and insert mode?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 18 Apr 2012, 01:56 PM
Hello Tina,

You can check for the CommandName in ItemCommand event and show corresponding UserControls.
C#:
protected void grid1_ItemCommand(object sender, GridCommandEventArgs e)
{
 if (e.CommandName == RadGrid.InitInsertCommandName)
  {
     e.Item.OwnerTableView.EditFormSettings.UserControlName = "WebUserControl1.ascx";
     e.Item.OwnerTableView.InsertItem();
  }
   else if (e.CommandName == RadGrid.EditCommandName)
   {
      e.Item.OwnerTableView.IsItemInserted = false;
      e.Item.OwnerTableView.EditFormSettings.UserControlName = "WebUserControl2.ascx";
   }
}

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