I have a RadGrid control with template edit form implementation. I need to have a subset of controls in edit mode template different from the subset of controls in the add mode template. I found a way to do that scenario, but I'm not sure it's the best way.
I did this by setting the controls in panels. In the code behind, I checked the type of the form and, depending on the condition, these controls are turned on or off by setting the visibility property using this snippet:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item is GridEditFormInsertItem && RadGridConferences.MasterTableView.IsItemInserted)
{
Panel UploadConferenceImage = e.Item.FindControl("UploadConferenceImage") as Panel;
Panel UploadConferenceNewsletter = e.Item.FindControl("UploadConferenceNewsletter") as Panel;
Panel ConferenceImagePanel = e.Item.FindControl("ConferenceImagePanel") as Panel;
RadEditor RadEditorConferenceTxtBody = e.Item.FindControl("RadEditorConferenceTxtBody") as RadEditor;
if (UploadConferenceImage != null && UploadConferenceNewsletter != null && ConferenceImagePanel != null)
{
UploadConferenceImage.Visible = true;
UploadConferenceNewsletter.Visible = true;
ConferenceImagePanel.Visible = false;
}
else
return;
if (RadEditorConferenceTxtBody != null)
{
RadEditorConferenceTxtBody.Style.Add("margin-top", "55px");
}
else
return;
}
}
Another option I found is creating my own custom editor.