This is a migrated thread and some comments may be shown as answers.

How to use the GridCalculatedColumn when there are no items in grid

1 Answer 153 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Venkatesh
Top achievements
Rank 1
Venkatesh asked on 08 Dec 2012, 08:25 AM
Hi,
I have added the "GridCalculatedColumn" in rad grid. where there are items in the grid, the calculated column is working fine. However when there are no items in grid, the gridcalculated column is giving the error as "operator * cannot be applied between string and string.".
Below is the code i have:

<telerik:GridTemplateColumn DataField="OrderQuantity" HeaderText="Order Quantity"
                    UniqueName="OrderQuantity" Visible="true">
                    <InsertItemTemplate>
                        <telerik:RadTextBox ID="RadtxtOrderQuantity" runat="server" Text="">
                        </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" >
                        </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>


How to modify the code to use when the grid has no items?
Thanks

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 12 Dec 2012, 03:07 PM
Hello Venkatesh,

I was not able to reproduce the issue described as evidenced by the attached sample. Please, take a look at it, modify it so that the problem is replicated and send it back to us for inspection. Thanks for that.

Greetings, Tsvetoslav
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.
Tags
Grid
Asked by
Venkatesh
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or