Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot convert type 'decimal' to 'string' in webgrid

299 views Asked by At

I am stuck with this error where I tried many different ways of conversion (see below) with no success. I need to use this in webGrid

Unfortunately all formats below return the same error:

 <span id="lblAmount" class="display-mode">Convert.ToString(@item.Amount)</span>
 <span id="lblAmount" class="display-mode">@item.Amount.ToString()</span>
 <span id="lblAmount" class="display-mode">(string)@item.Amount</span>
 <span id="lblAmount" class="display-mode">@String.Format("{0:N2}", @item.Amount)</span>
0

There are 0 answers