How to add a TemplateColumn dynamically to Repeater

Refer : How to add Templatecolumn dynamically to DataList? Now, instead of DataList use Repeater and make below changes VB.NET Public Sub BindLabelColumn(sender As Object, e As EventArgs) Dim lbl As Label = CType(sender, Label) Dim container As RepeaterItem = CType(lbl.NamingContainer, RepeaterItem) Dim strVals As String = Convert.ToString(DataBinder.Eval(CType(container, RepeaterItem).DataItem, ‘LastName’)) + ‘, ‘ + Convert.ToString(DataBinder.Eval(CType(container, RepeaterItem).DataItem, ‘FirstName’)) lbl.Text = strVals End Sub ’BindLabelColumn C# public void BindLabelColumn(object sender, EventArgs e) { Label lbl = (Label)sender; RepeaterItem container = (RepeaterItem)lbl.NamingContainer ; String strVals =Convert.ToString(DataBinder.Eval(((RepeaterItem)container).DataItem, ‘LastName’)) + ‘, ‘ + Convert.ToString(DataBinder.Eval(((RepeaterItem)container).DataItem, ‘FirstName’)) ; lbl.Text = strVals; }

How do I use Validator controls while editing data in the DataGrid?

Yes, you can use the Asp.Net validation controls inside a Datagrid. You’ll need to use a TemplateColumn, and on the TextBoxes (or other controls) in your EditItemTemplate, be sure to give them an ID. Then specify that ID as the ControlToValidate for the validation control. Refer How to edit data in DataGrid using TemplateColumn?