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

Formating cells of autogenerated column in radgrid

1 Answer 90 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Purojit
Top achievements
Rank 1
Purojit asked on 14 Jun 2013, 11:24 AM
Subject:-Calculated columns in autogenerated columns of Radgrid

Hi,

We have a rad grid with auto generated columns. We need to add a calculated columns  where values corresponding to these auto generated columns will be summed up. Please find below the exact requirement snap:-

CaseID

CASEDT

CARDIOLOGY

CTSCAN

TESTTotal

C001

2013/06/13

$500

$100

$600

C002

2013/06/13

$500

 

$500

C003

2013/06/14

 

$100

$100

C004

2013/06/14

$500

$100

$600



Yellow highlighted columns are auto  generated.

Please provide suitable solutions for the above mentioned.
Thanks & regards
Purojit

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 Jun 2013, 12:41 PM
Hi,

Try the following to get the total.
ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="true" DataSourceID="SqlDataSource1">
<MasterTableView>
   <Columns>
      <telerik:GridCalculatedColumn UniqueName="Total" HeaderText="Total" DataFields="Number,id" Expression="{0}+{1}">
      </telerik:GridCalculatedColumn>
   </Columns>
 </MasterTableView>
</telerik:RadGrid>

To get the calculated(Total) column at the end do the following as well.

C#:
protected void  RadGrid1_PreRender(object sender, EventArgs e)
 {
    RadGrid1.MasterTableView.SwapColumns("UniqueName1", "UniqueName2"); // to swap two columns
 }


Thanks,
Shinu.
Tags
Grid
Asked by
Purojit
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or