Friends please do help me. I have a RadGrid in my page and I am struggling with a few issues in accessing the GridDataItems. I am also receiving the error "
Cannot find a cell bound to column name". My aspx is as follows:
<Telerik:RadGrid ID="rgdActiveBatchJobs" runat="server"
AutoGenerateColumns="false"
AllowAutomaticInserts="false"
AllowMultiRowSelection="true"
OnItemCreated="rgdActiveBatchJobs_ItemCreated"
ShowGroupPanel="True"
GridLines="none">
<PagerStyle Mode="NumericPages"></PagerStyle>
<MasterTableView
AutoGenerateColumns="False"
GroupLoadMode="Client"
GroupsDefaultExpanded="false"
>
<GroupByExpressions>
<Telerik:GridGroupByExpression>
<SelectFields>
<Telerik:GridGroupByField FieldAlias="Plan"
FieldName="Plan"></Telerik:GridGroupByField>
</SelectFields>
<GroupByFields>
<Telerik:GridGroupByField FieldName="Plan"></Telerik:GridGroupByField>
</GroupByFields>
</Telerik:GridGroupByExpression>
</GroupByExpressions>
<Columns>
<Telerik:GridBoundColumn HeaderText="Active Batch
Jobs" DataField="Job Name" ReadOnly="true"
Visible="true"
UniqueName="Job
Name">
</Telerik:GridBoundColumn>
<Telerik:GridClientSelectColumn
HeaderText="Trigger"
DataTextField="Trigger"
UniqueName="Trigger">
</Telerik:GridClientSelectColumn>
<Telerik:GridTemplateColumn
HeaderText="Status">
<ItemTemplate>
<asp:Image ID="ActiceBatchJobImageCol"
runat="server"
ImageUrl=""
AlternateText="Not
Yet started to Promote" />
</ItemTemplate>
</Telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
<ClientSettings EnableRowHoverStyle="false"
AllowGroupExpandCollapse="True">
<Selecting AllowRowSelect="true"
UseClientSelectColumnOnly="true"></Selecting>
</ClientSettings>
<GroupingSettings ShowUnGroupButton="true"></GroupingSettings>
</Telerik:RadGrid>
As can be seen from above I have used grouping based on a field called "Plan" in the above grid. Now from server side when I wish to access grid rows based on the plan name and the column "Job Name" I am struggling a bit.
rgdActiveBatchJobs.DataSource = dt;
rgdActiveBatchJobs.DataBind();
foreach (GridDataItem item in rgdActiveBatchJobs.MasterTableView.Items)
{
string jobName = item["Job Name"].Text;
string planName = item["Plan"].Text;
}
in the above code the jobname is coming out fine but when it runs the line string planName = item["Plan"].Text; it throws an error "Cannot find a cell bound to column name 'Plan'" Could anyone please reply how to obtain the value of the group by field for each datarow of the radgrid.
Thanks and Regards,
Gaurav Agrawal