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

Grid InCell Editing with DropDowList with Decimal DataValueField

1 Answer 159 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 27 Jul 2017, 07:02 PM

I have a grid with an editor template like so:

@model decimal?
@(Html.Kendo().DropDownList()
      .Name("VatRate")
      .DataValueField("DecimalValue")
      .DataTextField("Name")
      .BindTo((System.Collections.IEnumerable)ViewData["VatRates"])
      )

 

In my grid I have the column defined like so:

columns.Bound(p => p.VatRate).EditorTemplateName("DropDownListVatRates");

 

The VatRate property is defined like so:

public decimal VatRate { getset; }

 

What I would like is for select the appropriate VAT rate and for the DDL to pass the decimal value back to the cell (something like this http://www.screencast.com/t/V41xQlYWq )

But I can't figure out how to do it, any help would be appreciated?

 

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 01 Aug 2017, 10:34 AM
Hello Tim,

Thank you for the provided information.

After observing the code and the video, I can assume that the desired result is to show the selected decimal value instead of the rounded value like 1 or 2?

If this is correct I can suggest using the column.format property which will allow displaying the number in the desired way:

http://docs.telerik.com/aspnet-mvc/api/Kendo.Mvc.UI.Fluent/GridBoundColumnBuilder#methods-Format(System.String)

If the format is not applied, I can suggest using the ClientTemplate():

http://docs.telerik.com/aspnet-mvc/api/Kendo.Mvc.UI.Fluent/GridBoundColumnBuilder#methods-ClientTemplate(System.String)

//decimalValue corresponds to the field
"#=kendo.toString(decimalValue, 'n5')#"

Let me know if I missed am an important detail.

Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Tim
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or