Click here to Skip to main content
15,891,372 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI Friends,

I have been using the MVC i have created the partial view and rendering the content form the model.

but when i making it string.format it is not formatted.

sample code i am placing for the referance.

XML
<tr bgcolor="#ffeadf">
       <td align="left">
           <%=result.ShowYear%>
       </td>
       <td align="left">
           <%=string.Format("{0:c}",result.ShowProjectRevenu)%>
       </td>
   </tr>


the plain contantes are displaying
I have tried goggling also but not understand why that format is not applying on the string.

Please help me.

Thanks
Posted
Updated 19-Aug-12 18:20pm
v2
Comments
AditSheth 17-Aug-12 4:47am    
is your spell for format is correct? and also F is in Upper letter.
"string.Format"
deepakaitr12345 18-Aug-12 7:41am    
Thanks for the reply.I have placed the string.Format correctly

the problem was solved by using the following statements

1)Add the name space System.globlization

2) <%="$ "+result.ShowProjectRevenu.ToString("0,0", CultureInfo.InvariantCulture)+".00"%>

Thanks

1 solution

you have string.formate. It's string.Format. <%= is ASP.NET syntax, I don't know if that even works in MVC3, you should use Razor syntax, it's more readable and people like me will be better able to help you if you're using what everyone else is.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900