Hi
I am facing a problem in telerik grid.
I have used BoundColumns as well as Template Columns like RadComboBox and MaskedTextBox in my Grid.
<
telerik:GridBoundColumn DataField="TimesheetDate" HeaderText="Timesheet Date" UniqueName="TimesheetDate" HeaderStyle-Width="20%">
<HeaderStyle Width="20%"></HeaderStyle></telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="Location" HeaderStyle-Width="30%" UniqueName="Location"><ItemTemplate>
<telerik:RadComboBox ID="RadComboBox6" Runat="server" CssClass="bodytxt" DataTextField="desc" DataValueField="Id" MarkFirstMatch="True" Skin="Web20" ToolTip="Select a recipient" Width="200px" DataSourceID="sqlLocations" Font-Size="10pt">
<CollapseAnimation Duration="200" Type="OutQuint" />
</telerik:RadComboBox>
</ItemTemplate>
<HeaderStyle Width="30%"></HeaderStyle>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Time In" HeaderStyle-Width="15%" UniqueName="TimeIn">
<ItemTemplate>
<asp:TextBox ID="txtTimeIn" runat="server" Width="75px" CssClass="textfields"></asp:TextBox> </ItemTemplate>
<HeaderStyle Width="15%"></HeaderStyle>
</telerik:GridTemplateColumn>
I am accessing the values of Bound Columns like this:
foreach (GridDataItem item in RadGrid1.MasterTableView.GetItems(new GridItemType[] {GridItemType.Item, GridItemType.AlternatingItem }))
{
GridDataItem dataitem = (GridDataItem)item;
TableCell cell = dataitem["TimesheetDate"];
TextBox tBox = (TextBox)cell.FindControl("TimesheetDate");
DateTime timesheetDate = Convert.ToDateTime(dataitem["TimesheetDate"].Text);
}
The Problem is:
When i try to access the value in the Template column while using the same method, I am getting a 'null' in the Text property.
Please note that i am accessing the values in <ItemTemplate> not in "<EditItemTemplate>"