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

Edit/Insert Templates different how to implement?

2 Answers 21 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Luis Silva
Top achievements
Rank 1
Luis Silva asked on 12 May 2010, 05:44 AM
At the moment I am setting the visibilty of controls on the itemdatabound event handler after detecting if row is in insert/edit mode.

if (e.Item is GridEditFormItem && e.Item.IsInEditMode) 
     (e.Item.FindControl("txtUserName"as WebControl).Enabled = false


This seems quite cumbersome to me, is there a better way to do it?

Thanks

Luis

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 May 2010, 06:46 AM
Hello Luis,

Showing different forms for edit and insert is easily achievable by using different WebUserControl custom edit form for your grid. You can hook the ItemCommand event of the grid and switch the user control when e.CommandName is RadGrid.EditCommand or RadGrid.InitInsertCommandName.

The following documentation describes more on how to accomplish this.
Different edit forms on edit and insert

Thanks,
Princy.
0
Luis Silva
Top achievements
Rank 1
answered on 12 May 2010, 07:53 AM
Hi Princy,

Thanks for the quick reply, that seems also quite convoluted, say I only have one field that i dont need...i need to create two nearly identical forms...

A good feature would be to allow an InsertTemplate element like the asp:Gridview.

Regards

Luis



Tags
Grid
Asked by
Luis Silva
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Luis Silva
Top achievements
Rank 1
Share this question
or