How to leave a maskedbox

Asked

Viewed 17 times

0

How do I leave values as real value, not a common number.

inserir a descrição da imagem aqui

I need these values to be as 2.00, if possible leaves R $ 2.00

My Controller:

 public ActionResult Adiciona(AbastecimentoModel viewModel)
    {
        viewModel.TotalGasto = viewModel.Litro * viewModel.VlrUnit;


        if (ModelState.IsValid)
        {
            Abastecimento abastecimento = viewModel.CriaAbastecimento();
            dao.Adiciona(abastecimento);
            //return View();
            return RedirectToAction("Index");
        }
        else
        {
            ViewBag.Usuarios = usuarioDAO.Lista();
            ViewBag.Veiculo = veiculoDAO.Lista();
            return View("Form",viewModel);
        }

    }

My view:

 @model IList<BlogWeb.Models.Abastecimento>
<!DOCTYPE HTML>
<p>@Html.ActionLink("Novo Abastecimento", "Form")</p>
<table class="table table-hover">

    <thead>

        <tr>
            <th>Nº do Carro</th>
            <th>Data</th>
            <th>Litro</th>
            <th>Valor Unitario</th>
            <th>Valor Total</th>
            <th>Usuario</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var a in Model)
        {
            <tr>

                <td>@a.NumCarro.NCarro</td>
                <td>@a.DtAbastecido</td>
                <td>@a.Litro</td>
                <td>@a.VlrUnit</td>
                <td>@a.TotalGasto</td>
                <td>@a.Autor.Nome</td>



            </tr>

        }
    </tbody>
</table>
  • Have you tried using javascript or string format

  • Sorry my ignorance, but how would the string format?

  • https://sites.google.com/site/tecguia/formatar-string-c-string-format

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.