Hi,
in a DDL I display entries of the following type:
public
class
ConfigEntryLine {
public
long
ItemID {
get
;
set
; }
public
string
ItemText {
get
;
set
; }
[DisplayFormat(DataFormatString =
"{0:c}"
)]
public
double
ItemPrice {
get
;
set
; }
In the dropdown I want to display the"ItemPrice" on the right side formatted like given in the attribute on the model.
I use the DDL like in a editfor like this:
...
else {
@(Html.Kendo().DropDownListFor(m => m.SelectedID)
.DataTextField("ItemText")
.DataValueField("ItemID")
.AutoBind(true)
.HtmlAttributes(new { style = "width:280px;font-size:small" })
.ValuePrimitive(true)
.BindTo(Model.Lines)
.Template("<
span
class=\"k-state-default\">#: data.ItemText#</
span
><
span
class=\"k-state-default pull-right\"><
strong
>#: data.ItemPrice#</
strong
>")
);
}
I get the value - as number without decimal places and currency sign.
Is it possible to use the DisplayFormat attribute in a DDL template?