
digish devassy
Top achievements
Rank 1
digish devassy
asked on 15 Oct 2012, 02:38 PM
I tried this:
if (e.Column.UniqueName.Contains("SomeColumn"))
{
GridBoundColumn item = (GridBoundColumn)e.Column;
item.Aggregate =
GridAggregateFunction.Avg;
}
@ column created step.
did not work.
Thanks in advance.
6 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 16 Oct 2012, 04:53 AM
Hi,
Try the following code to achieve your scenario.
C#:
Thanks,
Princy.
Try the following code to achieve your scenario.
C#:
protected
void
RadGrid1_ColumnCreated(
object
sender, Telerik.Web.UI.GridColumnCreatedEventArgs e)
{
if
(e.Column.UniqueName ==
"UniqueName"
)
{
GridBoundColumn boundColumn = e.Column
as
GridBoundColumn;
boundColumn.Aggregate = GridAggregateFunction.Avg;
}
}
Thanks,
Princy.
0

digish devassy
Top achievements
Rank 1
answered on 17 Oct 2012, 06:13 AM
SomeHow the unique name is not helping. Any other option please.
0

Princy
Top achievements
Rank 2
answered on 17 Oct 2012, 06:38 AM
Hi,
I am not quite sure how you are adding the columns. Try the following approach to add aggregate function when adding columns dynamically.
C#:
Thanks,
Princy.
I am not quite sure how you are adding the columns. Try the following approach to add aggregate function when adding columns dynamically.
C#:
GridBoundColumn boundColumn;
boundColumn =
new
GridBoundColumn();
RadGrid1.MasterTableView.Columns.Add(boundColumn);
boundColumn.DataField =
"EmployeeID"
;
boundColumn.HeaderText =
"EmployeeID"
;
boundColumn.Aggregate = GridAggregateFunction.Avg;
Thanks,
Princy.
0

digish devassy
Top achievements
Rank 1
answered on 18 Oct 2012, 04:28 AM
I solved it by adding the column in tghe aspx page. this solved it.
Thanks. Both of the above help was good. I had found the same solution over the internet.
Thanks again.
Thanks. Both of the above help was good. I had found the same solution over the internet.
Thanks again.
0

digish devassy
Top achievements
Rank 1
answered on 19 Oct 2012, 09:38 AM
the datasource to the grid is a pivoted table.. In this case, I tried the
protected
void
RadGrid1_ColumnCreated(
object
sender, Telerik.Web.UI.GridColumnCreatedEventArgs e)
{
if
(e.Column.UniqueName ==
"UniqueName"
)
{
GridBoundColumn boundColumn = e.Column
as
GridBoundColumn;
boundColumn.Aggregate = GridAggregateFunction.Avg;
}
}
All I get e.Column.UniqueName is gridexpandcolumn. no gridbound column. when I check the column details in the grid. it says grid bound column.
I tried the prerender step. It is not working. I am not sure @ what step the aggregate is be added in the databound column.
Thanks in advance.
0
Hi Digish,
Based on the provided information it is hard to say what is causing the described issue on your end. Could you please post your aspx page markup with the related code behind? Thus we will be able to get more information about your scenario and provide you more to the point answer. Looking forward for your reply.
Kind regards,
Radoslav
the Telerik team
Based on the provided information it is hard to say what is causing the described issue on your end. Could you please post your aspx page markup with the related code behind? Thus we will be able to get more information about your scenario and provide you more to the point answer. Looking forward for your reply.
Kind regards,
Radoslav
the Telerik team
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 their blog feed now.