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

How to change EditItemTemplate at run time ?

1 Answer 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bibhudutta
Top achievements
Rank 1
Bibhudutta asked on 08 Feb 2012, 10:28 AM
I have a grid and it that grid I have a column, which in edit mode will have Rad:TextBox in some cases and Rad:ComboBox in others.
But I am unable to achieve how to dynamically change the edit template to show the comboxes and textboxes in different situation. Please help me out.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 08 Feb 2012, 10:41 AM
Hello,

Try the following code.
C#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
  if (e.Item is GridEditableItem && e.Item.IsInEditMode)
  {
    GridEditableItem item = (GridEditableItem)e.Item;
    RadTextBox txt1 = (RadTextBox)item.FindControl("RadTextBox1");
    RadComboBox combo = (RadComboBox)item.FindControl("RadComboBox1");
  }
}

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