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

Calculate formula in one column

2 Answers 80 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
arnorgauti
Top achievements
Rank 1
arnorgauti asked on 30 Apr 2012, 12:29 PM
HI

If i have 3 columns:

  • Product name
  • Prize
  • Quanity

and i want to have the fourth column (Value) that calculates the values in column 2 and 3
Prize*Quantity = Value

or

column2*column3 = value

Could you help me ?


2 Answers, 1 is accepted

Sort by
0
Jerome
Top achievements
Rank 1
answered on 20 Aug 2012, 08:36 PM
This is how I did it... I am sure there are other ways...

@(Html.Telerik().Grid(Wages)
        .Name("Wages")
        .Columns(cols =>
        {
            cols.Bound(s => s.Name).Width(200);
            cols.Bound(s => s.Wage).Width(100);
            cols.Bound(s => s.Wage).Title("Salary").Width(150);
            cols.Bound(s => s.AdjustmentWage).Width(200);
            cols.Bound(s => s.pkey).Hidden();
        })
        .CellAction(cell =>
            {
                if (cell.Column.Title == "Salary")
                {
                    var wage = cell.DataItem;
                    double salaryamt = (double)(wage.Wage * 2080);
                    cell.Text = salaryamt.ToString("C");
                }
            }
      )
.Pageable()
.Sortable()
)
0
German
Top achievements
Rank 1
answered on 29 Oct 2012, 09:41 PM
Thanks Jerome for your response. Worked like a charm. And sorry for the delay!
Germán
Tags
Grid
Asked by
arnorgauti
Top achievements
Rank 1
Answers by
Jerome
Top achievements
Rank 1
German
Top achievements
Rank 1
Share this question
or