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

Apply a Constant in GridCalculatedColumn

1 Answer 100 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kencox
Top achievements
Rank 1
kencox asked on 02 Dec 2010, 05:54 PM
Hi folks,

I want to apply a conversion rate (set on the page outside the grid) to every row. For example:

<telerik:GridCalculatedColumn HeaderText="Cnv. Price" 
UniqueName="ConvertedSoldPrice"
 DataType="System.Double" 
DataFields="SoldPrice, ConversionRate" 
Expression="{0}*{1}" />

Since ConversionRate doesn't actually appear as a field in the database table (it's value comes from a textbox elsewhere on the same page), what's the best way of getting it incorporated in the calculated column?

Thanks,
Ken

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 03 Dec 2010, 01:52 PM
Hello Ken,


I hope you can try an alternate method by using GridTemplateColumn with Label placed inside instead of GridCalculatedColumn. Then from the client side, get reference to the TextBox and get the "ConversionRate" value. Now iterate through each rows in the grid from and calculate the result based on the cell value, access the Label in templatecolumn using "findElement() method" and set the text.

The docuemntation will be helpful in getting the cell value from grid.
Getting cell values for selected rows client side 


Dont hesitate to write again if you need any further help.


Regards,
Princy.
Tags
Grid
Asked by
kencox
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or