
ching ping
Top achievements
Rank 1
ching ping
asked on 03 Dec 2010, 08:58 AM
Hi,
I have a RadGrid and i want to show aggregate 'Sum' for one particular column in the footer. This RadGrid's data source is a data table which pulls data from an excel file. Below is my aspx codes for the RadGrid.
It gives me Sum is not supported for type "System.Object"' (refer to SumError.jpg) at my gvTestResult.DataBind() step.
I also tried to replace GridBoundColumn to GridNumericColumn and it gives me 'Specified cast is not valid' error(refer to InvalidCast.jpg).
Any advice?
I have a RadGrid and i want to show aggregate 'Sum' for one particular column in the footer. This RadGrid's data source is a data table which pulls data from an excel file. Below is my aspx codes for the RadGrid.
<telerik:RadGrid ID="gvTestResult" runat="server" AllowSorting="true"
ShowFooter="true">
<MasterTableView AutoGenerateColumns="false" EnableNoRecordsTemplate="true" >
<Columns>
<telerik:GridBoundColumn DataField="SPEED" HeaderText="SPEED">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DEMAND" HeaderText="DEMAND">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="AFTER_UTS" HeaderText="AFTER_UTS" Aggregate="Sum">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
It gives me Sum is not supported for type "System.Object"' (refer to SumError.jpg) at my gvTestResult.DataBind() step.
I also tried to replace GridBoundColumn to GridNumericColumn and it gives me 'Specified cast is not valid' error(refer to InvalidCast.jpg).
Any advice?
6 Answers, 1 is accepted
0
Hello,
After you replace GridBoundColumn with GridNumericColumn, try setting EnableLinqExpressions property to false and let me know about the result.
Kind regards,
Pavlina
the Telerik team
After you replace GridBoundColumn with GridNumericColumn, try setting EnableLinqExpressions property to false and let me know about the result.
Kind regards,
Pavlina
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

ching ping
Top achievements
Rank 1
answered on 03 Dec 2010, 10:42 AM
May i know how and where to set EnableLinqExpressions property to false?
0
Hello,
You can set the EnableLinqExpressions property of the RadGrid control as shown below:
ASPX:
Best wishes,
Pavlina
the Telerik team
You can set the EnableLinqExpressions property of the RadGrid control as shown below:
ASPX:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
EnableLinqExpressions
=
"false"
/>
Best wishes,
Pavlina
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

ching ping
Top achievements
Rank 1
answered on 03 Dec 2010, 02:47 PM
Hi Pavlina,
Attached is the error it generates when i set the EnableLinqExpressions property to false. Does it means that the data type of my data in that column is string and i wont be able to perform aggregation for string?
Attached is the error it generates when i set the EnableLinqExpressions property to false. Does it means that the data type of my data in that column is string and i wont be able to perform aggregation for string?
0

Mike
Top achievements
Rank 1
answered on 06 Dec 2010, 06:03 PM
I am getting the same error as ching ping.
I then load the DataSource with the returned dt.
(The error occurs on the ClientAmount value.)
protected
DataTable LoadAssistance()
{
DataSet ds =
new
DataSet();
DataTable dt =
new
DataTable();
DataColumn[] keys =
new
DataColumn[1];
String[] values;
dt.Columns.Add(
"ID"
);
dt.Columns.Add(
"AssistanceType"
);
dt.Columns.Add(
"PaymentType"
);
dt.Columns.Add(
"DatePaid"
);
dt.Columns.Add(
"Check#"
);
//dt.Columns.Add("Amount");
dt.Columns.Add(
"ClientAmount"
);
dt.Columns.Add(
"PaidTo"
);
dt.Columns.Add(
"Memo"
);
dt.Columns.Add(
"AuthorizedBy"
);
dt.Columns.Add(
"PaidBy"
);
foreach
(MAFA_AssistanceDetail ad
in
mCase.AssistanceDetail)
{
values =
new
[] { ad.ID.ToString(),
ad.AssistanceTypeID.ToString(),
ad.PaymentTypeID.ToString(),
ad.DateDisbursed.ToString(),
ad.CheckNumber.ToString(),
//ad.Amount.ToString(),
ad.ClientContribution.ToString(),
ad.PaidTo,
ad.Memo,
ad.AuthorizedByID.ToString(),
ad.PaidByID.ToString()};
dt.Rows.Add(values);
}
ds.Tables.Add(dt);
//if (ds.Tables.Count > 0)
// AssistanceGrid.DataSource = ds;
keys[0] = dt.Columns[
"ID"
];
dt.PrimaryKey = keys;
ViewState[WindowName.Text +
"AssistanceDT"
] = dt;
return
dt;
}
I then load the DataSource with the returned dt.
(The error occurs on the ClientAmount value.)
0
Hello Mike,
Can you please open a formal support ticket and send us a sample project for further debugging? Thus we will be able to get to the source of the problem and address it respectively.
Looking forward for your reply.
Kind regards,
Pavlina
the Telerik team
Can you please open a formal support ticket and send us a sample project for further debugging? Thus we will be able to get to the source of the problem and address it respectively.
Looking forward for your reply.
Kind regards,
Pavlina
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.