Hi, I just updated our Telerik ASP.NET AJAX Radcontrols from Q3 2009 to
Q3 2013, and the following code is not working anymore (see below), can
somebody help me please?
The page has this declaration in the DetailView part of the RadGrid (inside columns):
<telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn2" DefaultInsertValue="">
<ItemTemplate>
<asp:Panel ID="Panel2" runat="server">
<asp:CheckBox ID="CheckBox2" runat="server" Checked='<%# Bind("band") %>' OnCheckedChanged="checked_value" AutoPostBack="True"></asp:CheckBox>
</asp:Panel>
</ItemTemplate>
</telerik:GridTemplateColumn>
This checkbox can be checked by the user and needs to be extracted to be able to gather selected rows in master/detail grid.
The code that used to work is:
foreach (GridDataItem gdi in RadGrid1.Items)
{
if (gdi.ItemType == GridItemType.Item ||
gdi.ItemType == GridItemType.AlternatingItem)
{
try
{
if (gdi["CheckBoxTemplateColumn2"] != null &&
((CheckBox)gdi["CheckBoxTemplateColumn2"].FindControl("CheckBox2")).Checked)
{
if (gdi["deliveryNote"].Text.Trim() != " ")
deliveryNote += gdi["deliveryNote"].Text + ",";
materialDocument += gdi["MaterialDocument"].Text + ",";
purchaseOrder += gdi["purchaseOrder"].Text + ",";
}
}
catch (Exception ex)
{
}
}
}
The exception is entered when C# tries to execute this: gdi["CheckBoxTemplateColumn2"] and in debug it is throwing exception too.
Any help would be much appreciated.
Regards, Pieter
The page has this declaration in the DetailView part of the RadGrid (inside columns):
<telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn2" DefaultInsertValue="">
<ItemTemplate>
<asp:Panel ID="Panel2" runat="server">
<asp:CheckBox ID="CheckBox2" runat="server" Checked='<%# Bind("band") %>' OnCheckedChanged="checked_value" AutoPostBack="True"></asp:CheckBox>
</asp:Panel>
</ItemTemplate>
</telerik:GridTemplateColumn>
This checkbox can be checked by the user and needs to be extracted to be able to gather selected rows in master/detail grid.
The code that used to work is:
foreach (GridDataItem gdi in RadGrid1.Items)
{
if (gdi.ItemType == GridItemType.Item ||
gdi.ItemType == GridItemType.AlternatingItem)
{
try
{
if (gdi["CheckBoxTemplateColumn2"] != null &&
((CheckBox)gdi["CheckBoxTemplateColumn2"].FindControl("CheckBox2")).Checked)
{
if (gdi["deliveryNote"].Text.Trim() != " ")
deliveryNote += gdi["deliveryNote"].Text + ",";
materialDocument += gdi["MaterialDocument"].Text + ",";
purchaseOrder += gdi["purchaseOrder"].Text + ",";
}
}
catch (Exception ex)
{
}
}
}
The exception is entered when C# tries to execute this: gdi["CheckBoxTemplateColumn2"] and in debug it is throwing exception too.
Any help would be much appreciated.
Regards, Pieter