How to format currency column of a WebGrid?

0

How to format the Value column of the WebGrid? Example of 3000,000 for 3,000.00 ?

    @grid.GetHtml(
    tableStyle: "webgrid",
    headerStyle: "header",
    alternatingRowStyle: "alt",
    selectedRowStyle: "select",
    footerStyle: "footer",
    columns: grid.Columns(
    grid.Column("", format: @<text><div style="float:left; width:100%"><div style="float:left; width:75%"><strong>Fornecedor:</strong>&nbsp;&nbsp;@item.NomeFantasia</div><div style="float:left; width:25%">&nbsp;&nbsp;<strong>Data Venc.:</strong>&nbsp;&nbsp;@item.DtVencimento.ToString("dd/MM/yyyy") </div></div><br /><div style="float:left; width:75%">&nbsp;&nbsp;<strong>Valor Doc.:</strong>&nbsp;&nbsp;@item.ValorDocumento</div><div style="float:left; width:25%">&nbsp;&nbsp;<strong>Situação:</strong>&nbsp;&nbsp;@item.NmTipoSituacao</div><br /><div style="float:left; width:100%">&nbsp;&nbsp;<strong>Descrição:</strong>&nbsp;&nbsp;@item.DsMovimento</div></text>)

    )
)
    
asked by anonymous 14.02.2016 / 21:54

1 answer

1

One option would be to replace this code:

<strong>Valor Doc.:</strong>&nbsp;&nbsp;@item.ValorDocumento

For this code:

<strong>Valor Doc.:</strong>&nbsp;&nbsp;@string.Format(new System.Globalization.CultureInfo("pt-BR"), "{0:c}", @item.ValorDocumento)
    
14.02.2016 / 23:30