Posted 17 Dec 2010 Link to this post
Posted 20 Dec 2010 Link to this post
protected
void
RadGrid1_ItemDataBound(
object
sender, Telerik.Web.UI.GridItemEventArgs e)
{
if
(e.Item
is
GridEditFormItem && !e.Item.IsInEditMode)
GridEditFormItem editItem = (GridEditFormItem)e.Item;
RadComboBox combo = (RadComboBox)editItem.FindControl(
"controlID"
);
combo.DataSource = dt;
// set the datasource here
}
Posted 21 Dec 2010 Link to this post
GridTemplateColumn templateColumn = new GridTemplateColumn();
templateColumn.EditItemTemplate = new MyEditTemplate(templateColumnName);
templateColumn.ItemTemplate = new MyTemplate(templateColumnName);
templateColumn.HeaderText = _i2Object._i2Arguments[i].DisplayName;
templateColumn.DataField = _i2Object._i2Arguments[i].DataTextField;
this.RadGrid1.MasterTableView.Columns.Add(templateColumn);
public class MyTemplate : ITemplate
protected RequiredFieldValidator validatorTextBox;
protected TextBox textBox;
private string colname;
public MyTemplate(string cName)
colname = cName;
public void InstantiateIn(System.Web.UI.Control container)
textBox = new TextBox();
textBox.ID = "templateColumnTextBox";
textBox.DataBinding += new EventHandler(textBox_DataBinding);
validatorTextBox = new RequiredFieldValidator();
validatorTextBox.ControlToValidate = "templateColumnTextBox";
validatorTextBox.ErrorMessage = "*";
container.Controls.Add(textBox);
container.Controls.Add(validatorTextBox);
public void textBox_DataBinding(object sender, EventArgs e)
TextBox txt = (TextBox)sender;
GridDataItem container = (GridDataItem)txt.NamingContainer;
txt.Text = ((DataRowView)container.DataItem)[colname].ToString();
Posted 20 Nov 2012 Link to this post
Posted 23 Nov 2012 Link to this post
Posted 27 Nov 2012 Link to this post
Posted 28 Nov 2012 Link to this post
Posted 29 Nov 2012 Link to this post
Posted 13 Jun 2020 in reply to Princy Link to this post
Hello Princys
I need this artical and cant find it. Please let me know where can I find this link?
Posted 16 Jun 2020 Link to this post
Hi Jack,
The forum thread (Creating EditItemTemplate of GridTemplateColumn programmatically) you are looking for is not active anymore since it was for RadControls for ASP.NET which was discontinued in 2009 in favor of RadControls for ASP.NET AJAX - now called Telerik UI for ASP.NET AJAX.
For your convenience, I pasted the forum thread discussion in a Word file and attached it to my reply.
Regards, Rumen Progress Telerik