c# - Trying to convert object to integer to show as a percentage, but it only shows 0 -


i have object value in data type decimal(18,2). try convert integer data value show 0 although 6.

i want show value 0.06 6. can me why still shows 0?

<td class="line_table_td" style="text-align: center;">   <%#getpercentage(eval("value"))%>&nbsp; </td>  public decimal getpercentage(object value) {     var perc = convert.toint32(value);     return(perc); } 

if should decimal value, converting integer drop fractional portion.

convert decimal first, multiply 100 "percentage" representation.

public decimal getpercentage(object value) {     var percentage = convert.todecimal(value) * 100;      return percentage; } 

Popular posts from this blog

javascript - Js, document.getElementById("ID").innerHTML, error -

jquery - jqGrid update specific column data with out refreshing the entire column? -

objective c - Is there a way in OCMockito to make stubs fail when an unknown method is called? -