Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all ,

in cshtml(Razor View) how can i convert String type to Int in ViewBag
i wrote the following Code in ViewBag.MulNo i passed 90


C#
@for (int i = 1; i < 11; i++)
{
    <p>  @ViewBag.MulNo X @i  = (@ViewBag.MulNo * @i) </p>
}



but i am getting the following out put

90 X 1 = (90 * 1)
90 X 2 = (90 * 2)
.
.
.
90 X 10 = (90 * 10)


Thank
Sudheer.N

i need the out put is

90 X 1 = 90
90 X 2 = 180
.
.
.
90 X 10 = 900
Posted
Updated 17-May-12 1:11am
v2

1 solution

try:
HTML
<p>  @ViewBag.MulNo X @i  =@Html.Raw(string.Format("{0}",(@ViewBag.MulNo * @i))) </p>


it is working.
 
Share this answer
 
Comments
Sudheer Nimmagadda 17-May-12 8:19am    
Thank you very much , it is working fine
member60 17-May-12 23:48pm    
welcome
VJ Reddy 18-May-12 0:25am    
Good answer. 5!

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