or

<telerik:RadGrid ID="TimeSlotScheduleGrid" runat="server" EnableViewState="True" AutoGenerateColumns="False" Width="584" ShowFooter="false" onItemDataBound="TimeSlotScheduleGrid_RowDataBound" onItemCommand="TimeSlotScheduleGrid_RowCommand" OnColumnCreated="TimeSlotScheduleGrid_ColumnCreated"> <MasterTableView DataKeyNames="Id" GroupLoadMode="Client" Width="99%"> <GroupByExpressions> <telerik:GridGroupByExpression> <SelectFields> <telerik:GridGroupByField FieldName="GameNo" HeaderText="Game Number" HeaderValueSeparator=": " /> </SelectFields> <GroupByFields> <telerik:GridGroupByField FieldName="GameNo" SortOrder="Ascending" /> </GroupByFields> </telerik:GridGroupByExpression> </GroupByExpressions> <Columns> <telerik:GridTemplateColumn HeaderText='Time Slot'> <HeaderStyle Width="130" /> <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" /> <ItemTemplate> <asp:Label ID="timeSlotLabel" runat="server" /> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView> <ClientSettings EnableRowHoverStyle="false"> <Selecting AllowRowSelect="false" /> <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True" FrozenColumnsCount="1"/> </ClientSettings> </telerik:RadGrid>for (int wk = 1; wk < (maxWeeks + 1); wk++) { GridTemplateColumn templateColumn = new GridTemplateColumn(); string columnName = "W" + wk.ToString(); templateColumn.HeaderText = columnName; templateColumn.HeaderStyle.Width = new Unit(40); templateColumn.UniqueName = columnName; templateColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center; templateColumn.ItemStyle.VerticalAlign = VerticalAlign.Top; if(divisionObj.IsManualTimeSlotEntry) templateColumn.ItemTemplate = new TimeSlotCheckBoxTemplate(columnName); else templateColumn.ItemTemplate = new TimeSlotTemplate(columnName); TimeSlotScheduleGrid.MasterTableView.Columns.Add(templateColumn); } private class TimeSlotTemplate : ITemplate { private string templateName; //controls private Label label; private LinkButton linkButton; private Image image; public TimeSlotTemplate(string name) { templateName = name; } public void InstantiateIn(System.Web.UI.Control container) { label = new Label(); label.ID = templateName + "Label"; linkButton = new LinkButton(); linkButton.ID = templateName + "Button"; image = new Image(); image.ID = templateName + "Image"; linkButton.Controls.Add(image); container.Controls.Add(label); container.Controls.Add(linkButton); } }