1.

Can you write down some syntax for Razor in MVC3

Answer»

Below i have GIVEN some syntax of razor as well as some comparison with the old technlogies used before Razor
(1)First for datetime
(i)New Razor code for datatime
DateTime.Now
(II)Old code for datetime
< % =DateTime.Now%>


(2)Syntax for ForEach loop
foreach (string obj in obj)
{
obj
}


(3)Code for multiple lines we will add at first row
{
LIST objlst = new List ();
objlst.Add("dotnet");
objlst.Add("java");
objlst.Add("php");
objlst.Add("sql");
}


(4)To HTML display with Razor
{
var link = "< a href='http://www.getproductprice.com'>CLICK here< /a>";
}link;
Here in above code you will get OUTPUT as < a href='http://www.getproductprice.com' >Click here


(5)ANd to display link we use below code
{
var link = "< a href='http://www.getproductprice.com' >Click here< /a>";
Html.Raw(link);
Now with above code will will get link Click Here only



Discussion

No Comment Found