javascript - Displayformat fails to format -


i have picked mvc solution , trying format double variable 2 decimal places on form table. in modelview set using

[displayformat(dataformatstring = "{0:f2}", applyformatineditmode = true)]  

before public double declaration not passed through table. table created using javascript.

i have tried modify variable in javascript fails. here extract of code used

<div class="row">     <div class="col-md-3">journey distance in miles</div>     <div class="col-md-9">@model.miles</div> </div> 

the web page displays value without formatting new this, apologize in advance if obvious

it looks displayformat isn't taking.

i'm guessing model.miles isn't string. if not.. try this:

<div class="row">     <div class="col-md-3">journey distance in miles</div>     <div class="col-md-9">@model.miles.tostring("#.##")</div> </div> 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -