Hi I am new to telerik and trying to group grid based on PG_C_ENTITY_ID. though this field is available in data source I am getting the error :Field PG_C_ENTITY_ID not found in the source table. Please check the expression syntax.
PFA the datasource image. please guide on the same.
on ascx page :
<telerik:RadGrid RenderMode="Lightweight" ID="PricingGroupGrid" runat="server" PageSize="20"
AllowMultiRowSelection="True" AllowPaging="True" ShowGroupPanel="True"
AutoGenerateColumns="False" GridLines="none" OnNeedDataSource="PricingGroupGrid_NeedDataSource"
OnItemCommand="PricingGroupGrid_ItemCommand">
<PagerStyle Mode="NextPrevNumericAndAdvanced"></PagerStyle>
<MasterTableView Width="100%">
<GroupByExpressions>
<telerik:GridGroupByExpression>
<SelectFields>
<telerik:GridGroupByField FieldName="PG_C_ENTITY_ID"></telerik:GridGroupByField>
</SelectFields>
<GroupByFields>
<telerik:GridGroupByField FieldName="PG_C_ENTITY_ID"></telerik:GridGroupByField>
</GroupByFields>
</telerik:GridGroupByExpression>
</GroupByExpressions>
<Columns>
<telerik:GridEditCommandColumn HeaderText="Edit" ButtonType="ImageButton" UniqueName="EditCommandColumn" HeaderStyle-Font-Bold="true">
<HeaderStyle Width="80px"></HeaderStyle>
<ItemStyle CssClass="MyImageButton"></ItemStyle>
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn SortExpression="PricingTyp" HeaderText="Type" UniqueName="PricingTyp" HeaderButtonType="TextButton" HeaderStyle-Font-Bold="true"
DataField="PricingTyp">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="RatePlanId" HeaderText="Rate Plan Id" HeaderButtonType="TextButton" HeaderStyle-Font-Bold="true"
DataField="RatePlanId">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="DisplayStartDate" HeaderText="Start Date" HeaderButtonType="TextButton" HeaderStyle-Font-Bold="true"
DataField="DisplayStartDate">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="DisplayEndDate" HeaderText="End Date" HeaderButtonType="TextButton" HeaderStyle-Font-Bold="true"
DataField="DisplayEndDate">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="DisplayRate1" HeaderText="Rate" HeaderButtonType="TextButton" HeaderStyle-Font-Bold="true"
DataField="DisplayRate1">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="RateClass" UniqueName="RateClass" HeaderText="Rate Class" HeaderButtonType="TextButton" HeaderStyle-Font-Bold="true"
DataField="RateClass">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings ReorderColumnsOnClient="false" AllowDragToGroup="false" AllowColumnsReorder="false">
<Selecting AllowRowSelect="True"></Selecting>
<Resizing AllowRowResize="false" AllowColumnResize="false" EnableRealTimeResize="false"
ResizeGridOnColumnResize="False"></Resizing>
</ClientSettings>
<GroupingSettings ShowUnGroupButton="false"></GroupingSettings>
</telerik:RadGrid>
on ascx.cs page:
int pgId = 0;
IEnumerable<LGCPricingGroup> lgcPricingGroup = new Prospects().GetPricingGroups(dealsheetId);
List<LGCPricingBlock> lstPricingBlocks = new List<LGCPricingBlock>();
//IEnumerable<LGCPricingBlock> lgcPricingBlocks = Enumerable.Empty<LGCPricingBlock>();
foreach (var lgcPgGroup in lgcPricingGroup)
{
pgId = lgcPgGroup.Id;
List<LGCPricingBlock> lstPricingBlock = new List<LGCPricingBlock>();
IEnumerable<LGCPricingBlock> lgcPricingBlocks = new Prospects().GetPricingBlocksByPricingGroup(pgId);
lstPricingBlock = lgcPricingBlocks.ToList();
foreach (var item in lstPricingBlock)
{
//GridGroupByExpression expression = new GridGroupByExpression();
//GridGroupByField gridGroupByField = new GridGroupByField();
//gridGroupByField = new GridGroupByField();
//gridGroupByField.FieldName = "item.PG_C_ENTITY_ID";
//gridGroupByField.FieldAlias = "item.PG_C_ENTITY_ID";
//gridGroupByField.HeaderText = "Pricing Group" + lgcPgGroup.PricingGroupSeq;
//expression.SelectFields.Add(gridGroupByField);
//RadGrid1.MasterTableView.GroupByExpressions.Add(expression);
lstPricingBlocks.Add(item);
}
}
PricingGroupGrid.DataSource = lstPricingBlocks;
PricingGroupGrid.DataBind();