6 Answers, 1 is accepted
0
Hello Satz,
Based on the provided information it is hard to say what is causing the described issue on your end. I tried to reproduce it on my end, but to no avail. Also I tried to reproduce it on the following demo but everything works as expected:
http://demos.telerik.com/aspnet-ajax/grid/examples/columns-rows/columns/context-menu/defaultcs.aspx
Could you please post your aspx markup code with the related code behind file? Thus we will be able to gather more details about your scenario and provide you more to the point answer.
Looking forward for your reply.
Regards,
Radoslav
Telerik
Based on the provided information it is hard to say what is causing the described issue on your end. I tried to reproduce it on my end, but to no avail. Also I tried to reproduce it on the following demo but everything works as expected:
http://demos.telerik.com/aspnet-ajax/grid/examples/columns-rows/columns/context-menu/defaultcs.aspx
Could you please post your aspx markup code with the related code behind file? Thus we will be able to gather more details about your scenario and provide you more to the point answer.
Looking forward for your reply.
Regards,
Radoslav
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Princy
Top achievements
Rank 2
answered on 21 Nov 2013, 07:29 AM
Hi ,
Its hard to identify the issue. Make sure you have the columns bound to radgrid properly and the column DataField is same as in DB. Below is a sample code snippet that i tried, please give a try. If this doesn't help,please provide your full code snippet.
ASPX:
Thanks,
Princy
Its hard to identify the issue. Make sure you have the columns bound to radgrid properly and the column DataField is same as in DB. Below is a sample code snippet that i tried, please give a try. If this doesn't help,please provide your full code snippet.
ASPX:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AutoGenerateColumns
=
"false"
ShowFooter
=
"true"
EnableHeaderContextAggregatesMenu
=
"true"
EnableHeaderContextMenu
=
"true"
>
<
MasterTableView
DataKeyNames
=
"OrderID"
>
<
Columns
>
<
telerik:GridBoundColumn
UniqueName
=
"OrderID"
DataField
=
"OrderID"
HeaderText
=
"OrderID"
Aggregate
=
"Count"
/>
<
telerik:GridBoundColumn
DataField
=
"ShipCity"
HeaderText
=
"ShipCity"
UniqueName
=
"ShipCity"
Aggregate
=
"CountDistinct"
/>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
Thanks,
Princy
0
Satz
Top achievements
Rank 1
answered on 26 Nov 2013, 04:55 AM
Hi,
The Exception arise in the GridGroupFooterTemplate labels . My columns are created dynamically .
Best Regards,
Satz
The Exception arise in the GridGroupFooterTemplate labels . My columns are created dynamically .
<
GroupFooterTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"OrderId"
Visible
=
"false"
Text='<%# "OrderId: "+ ColumnCheck("OrderId")%>'></
asp:Label
>
</
GroupFooterTemplate
>
Best Regards,
Satz
0
Princy
Top achievements
Rank 2
answered on 26 Nov 2013, 05:53 AM
Hi Satz,
Its hard to identify the issue, please provide your full code snippet. The footer totals can be accessed using Eval(). Below is a sample code snippet that I tried which works fine at my end.
ASPX:
C#:
Thanks,
Princy
Its hard to identify the issue, please provide your full code snippet. The footer totals can be accessed using Eval(). Below is a sample code snippet that I tried which works fine at my end.
ASPX:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
ShowFooter
=
"true"
EnableHeaderContextAggregatesMenu
=
"true"
EnableHeaderContextMenu
=
"true"
GroupingSettings-RetainGroupFootersVisibility
=
"true"
. . >
<
MasterTableView
DataKeyNames
=
"OrderID"
ShowGroupFooter
=
"true"
>
<
GroupFooterTemplate
>
OrderID:
<
asp:Label
ID
=
"Label1"
runat
=
"server"
Text='<%# Eval("OrderID") %>'>
</
asp:Label
>
</
GroupFooterTemplate
>
<
GroupByExpressions
>
<
telerik:GridGroupByExpression
>
<
GroupByFields
>
<
telerik:GridGroupByField
FieldName
=
"ShipCity"
/>
</
GroupByFields
>
<
SelectFields
>
<
telerik:GridGroupByField
FieldName
=
"ShipCity"
Aggregate
=
"Count"
FieldAlias
=
"ShipCountry"
HeaderText
=
"ShipCity"
/>
</
SelectFields
>
</
telerik:GridGroupByExpression
>
</
GroupByExpressions
>
</
MasterTableView
>
</
telerik:RadGrid
>
C#:
protected
void
Page_Load(
object
sender, System.EventArgs e)
{
if
(!IsPostBack)
{
GridBoundColumn boundColumn;
boundColumn =
new
GridBoundColumn();
RadGrid1.MasterTableView.Columns.Add(boundColumn);
boundColumn.DataField =
"OrderID"
;
boundColumn.HeaderText =
"OrderID"
;
boundColumn.Aggregate = GridAggregateFunction.Sum;
boundColumn =
new
GridBoundColumn();
RadGrid1.MasterTableView.Columns.Add(boundColumn);
boundColumn.DataField =
"ShipName"
;
boundColumn.HeaderText =
"Ship Name"
;
}
}
Thanks,
Princy
0
Satz
Top achievements
Rank 1
answered on 26 Nov 2013, 08:54 AM
Hi Princy,
Columns are generated dynamically from the stored procedure . So, to visible GroupFooter Label , am checking whether the column is in the source. If it is present then i am returning with using Eval()(in VisibleColumn method).
The error occurs in the visiblecolumn eval() , when selecting the aggregates NONE.
Best Regards,
Satz
<
telerik:RadGrid
runat
=
"server"
ID
=
"radgrid"
ShowFooter
=
"True"
CssClass
=
"RadGrid"
OnItemCommand
=
"radgrid_ItemCommand"
OnColumnCreated
=
"radgrid_ColumnCreated"
OnNeedDataSource
=
"radgrid_NeedDataSource"
OnPreRender
=
"radgrid_PreRender"
AllowFilteringByColumn
=
"True"
AllowSorting
=
"True"
AutoGenerateColumns
=
"true"
Width
=
"850px"
Height
=
"600px"
ShowGroupPanel
=
"True"
AllowPaging
=
"True"
CellSpacing
=
"0"
GridLines
=
"None"
PageSize
=
"50"
PagerStyle-Visible
=
"true"
>
<
ExportSettings
HideStructureColumns
=
"true"
>
</
ExportSettings
>
<
PagerStyle
Mode
=
"Advanced"
AlwaysVisible
=
"true"
/>
<
MasterTableView
ShowGroupFooter
=
"true"
AllowMultiColumnSorting
=
"true"
UseAllDataFields
=
"true"
CommandItemDisplay
=
"Top"
EnableHeaderContextMenu
=
"true"
TableLayout
=
"Auto"
EnableHeaderContextAggregatesMenu
=
"true"
>
<
CommandItemSettings
ShowExportToExcelButton
=
"true"
ShowAddNewRecordButton
=
"false"
></
CommandItemSettings
>
<
GroupFooterTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"OrderId"
Visible
=
"false"
Text='<%# "OrderId: "+ VisibleColumn("OrderId")%>'></
asp:Label
>
<
asp:Label
runat
=
"server"
ID
=
"PurchaseCost"
Visible
=
"false"
Text='<%# "Cost: "+ VisibleColumn("Cost")%>'></
asp:Label
>
<
asp:Label
runat
=
"server"
ID
=
"RefundAmount"
Visible
=
"false"
Text='<%# "Refund Amount: "+ VisibleColumn("RefundAmount") %>'></
asp:Label
>
</
GroupFooterTemplate
>
</
MasterTableView
>
<
ClientSettings
AllowDragToGroup
=
"True"
AllowColumnsReorder
=
"True"
ClientEvents-OnColumnContextMenu
=
"oncontextmenuClick"
>
<
Scrolling
AllowScroll
=
"True"
></
Scrolling
>
</
ClientSettings
>
<
GroupingSettings
ShowUnGroupButton
=
"true"
></
GroupingSettings
>
</
telerik:RadGrid
>
protected object VisibleColumn(string columnName)
{
object dataBind = string.Empty; ;
foreach (GridColumn col in radgrid.MasterTableView.AutoGeneratedColumns)
{
if (col.UniqueName.Equals(columnName))
{
dataBind = Eval(columnName);
return dataBind;
}
}
return string.Empty;
}
Columns are generated dynamically from the stored procedure . So, to visible GroupFooter Label , am checking whether the column is in the source. If it is present then i am returning with using Eval()(in VisibleColumn method).
The error occurs in the visiblecolumn eval() , when selecting the aggregates NONE.
Best Regards,
Satz
0
Hi Satz,
I tried to reproduce the described issue, but to no avail. I am sending you a simple example based on your code. Please check it out and let me know what differs in your case.
Also more information about header and footer templates you can find here:
http://www.telerik.com/help/aspnet-ajax/grid-group-header-footer-templates.html
Looking forward for your reply.
Regards,
Radoslav
Telerik
I tried to reproduce the described issue, but to no avail. I am sending you a simple example based on your code. Please check it out and let me know what differs in your case.
Also more information about header and footer templates you can find here:
http://www.telerik.com/help/aspnet-ajax/grid-group-header-footer-templates.html
Looking forward for your reply.
Regards,
Radoslav
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.