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

different ascx forms for insert and update

1 Answer 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 13 Apr 2012, 01:44 AM
Hi,

Wondering if you can have different ascx forms for inserting informaiton and updating information, becuase sometimes I do not want they to update all the information but only certain portions.  Is there a way to do via ascx pages or inline with the grid as well.

Thanks

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 13 Apr 2012, 06:04 AM
Hello Kevin,

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
Grid
Asked by
Kevin
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or