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?

How can I use a Calendar Control to show specific dates highlighted and display relevant data for that date

<asp:Calendar id=’Calendar1′ OnDayRender =’CalDayRender’ runat=’server’></asp:Calendar> Dim ds As DataSet Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ’Put user code to initialize the page here ’Fill the DataSet End Sub Protected Sub CalDayRender(ByVal sender As Object, ByVal e As DayRenderEventArgs) Dim strName As New StringBuilder strName.Append(‘ ‘) Dim theDay As DateTime = e.Day.Date Dim sql As String = ‘hiredate=’’ + DateTime.Parse(theDay.ToString(‘d’)) + ‘’ ‘ Dim dr As DataRow() = ds.Tables(0).Select(sql) Dim drRow As DataRow For Each drRow In dr strName.Append(‘’<a href=empdetails.aspx?id=’ + drRow(‘Employeeid’).ToString() + ‘>’ + drRow(‘FirstName’).ToString() + ‘ ‘ + drRow(‘LastName’).ToString() + ‘</a><br>’’) e.Cell.BackColor = Color.Teal e.Cell.ForeColor = Color.Wheat Next drRow strName.Append(”) e.Cell.Controls.Add(New LiteralControl(strName.ToString())) End Sub ’CalDayRender C# DataSet ds ; private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here //Populate the DataSet } protected void CalDayRender(object sender, DayRenderEventArgs e) { StringBuilder strName = new StringBuilder(); strName.Append(‘ ‘); DateTime theDay = e.Day.Date; string sql =’hiredate=’’ + DateTime.Parse ( theDay.ToString(‘d’)) + ‘’ ‘; DataRow [] dr = ds.Tables[0].Select(sql); foreach(DataRow drRow in dr) { strName.Append(‘’<a href=empdetails.aspx?id=’ + drRow(‘Employeeid’).ToString() + ‘>’ + drRow(‘FirstName’).ToString() + ‘ ‘ + drRow(‘LastName’).ToString() + ‘</a><br>’’) e.Cell.BackColor = Color.Teal; e.Cell.ForeColor = Color.Wheat; } strName.Append(”); e.Cell.Controls.Add(new LiteralControl(strName.ToString())); }

Why doesn’t my Collection Properties get saved in the aspx file properly during design-time?

Some common mistakes that will cause the designer to choke while persisting collection properties are: The corresponding collection type cannot have multiple (overloaded) indexers. You should always define a single indexer of the type ‘public SomeType this[object obj]{…}‘. Otherwise the changes will be persisted but the control will not load in the designer. You will see a ‘Ambiguous match found’ error. If the collection property has the PersistenceMode attribute set to InnerProperty then the property should not include a set method.