Hi,
In my aspx page, i have the below columns:
When the page loads, i am binding the grid with empty datatable:
I am getting the error as "operator * cannot be applied between string and string".
The columns are integer type in sql. How to to fix this?
Thanks
In my aspx page, i have the below columns:
<
telerik:GridTemplateColumn
DataField
=
"OrderQuantity"
HeaderText
=
"Order Quantity"
UniqueName
=
"OrderQuantity"
Visible
=
"true"
>
<
InsertItemTemplate
>
<
telerik:RadTextBox
ID
=
"RadtxtOrderQuantity"
runat
=
"server"
Text='<%# Bind("OrderQuantity") %>'>
</
telerik:RadTextBox
>
</
InsertItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadTextBox
ID
=
"RadtxtOrderQuantity"
runat
=
"server"
Text='<%# Eval("OrderQuantity") %>'>
</
telerik:RadTextBox
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
telerik:RadTextBox
ID
=
"RadtxtOrderQuantity"
ReadOnly
=
"true"
runat
=
"server"
Text='<%# Eval("OrderQuantity") %>' />
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"UnitPrice"
HeaderText
=
"Unit Price"
UniqueName
=
"UnitPrice"
Visible
=
"true"
>
<
InsertItemTemplate
>
<
telerik:RadNumericTextBox
ID
=
"RadtxtUnitPrice"
runat
=
"server"
Text='<%# Bind("UnitPrice") %>'>
</
telerik:RadNumericTextBox
>
</
InsertItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadNumericTextBox
ID
=
"RadtxtUnitPrice"
runat
=
"server"
Text='<%# Eval("UnitPrice") %>'>
</
telerik:RadNumericTextBox
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
telerik:RadNumericTextBox
ID
=
"RadtxtUnitPrice"
Type
=
"Currency"
ReadOnly
=
"true"
runat
=
"server"
Text='<%# Eval("UnitPrice") %>' />
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridCalculatedColumn
DataFormatString
=
"{0:C}"
DataType
=
"System.Double"
HeaderText
=
"Extended Price"
UniqueName
=
"ExtendedPrice"
DataFields
=
"OrderQuantity,UnitPrice"
Expression
=
"{0}*{1}"
FooterText
=
"Total : "
Aggregate
=
"Sum"
>
</
telerik:GridCalculatedColumn
>
When the page loads, i am binding the grid with empty datatable:
private
DataTable CreateEmptyTable()
{
DataTable dt =
new
DataTable(
"PurchaseData"
);
try
{
dt.Columns.Add(
new
DataColumn(
"OrderQuantity"
));
dt.Columns.Add(
new
DataColumn(
"UnitPrice"
));
dt.Columns.Add(
new
DataColumn(
"ExtendedPrice"
));
DataRow dr = dt.NewRow();
dr[
"OrderQuantity"
] = 0;
dr[
"UnitPrice"
] = 0;
dr[
"ExtendedPrice"
] = 0;
dt.Rows.Add(dr);
}
catch
(Exception)
{
throw
;
}
return
dt;
}
bindgrid()
{
radgrid1.DataSource = CreateEmptyTable();
radgrid1.DataBind();
}
I am getting the error as "operator * cannot be applied between string and string".
The columns are integer type in sql. How to to fix this?
Thanks