Hi Guest
MobileUser
HomePage
Jobs
WalkIn
Articles
Agile
DotNet
WebServices
Mathematics
OOPS
WEB
SharePoint
Java
DataBase
Artificial Intelligence
BigData
Android
XML
Agile
Software
SEO
Science Techonlogy
Repository Questions
PHP
Frameworks
Server
Testing
HR
Java
TPF
Tutorial
Tools
Test and Papers
Silverlight
Science Techonlogy
----- Select Country -----
----- Select Location -----
----- Select Category -----
:) Latest Topic
AJAX
VB.NET
SQL Query
UDDI
CLASS
JavaScript Questions
SharePoint Interview
SilverLight
WCF
general knowledge
ASP.NET
:) Hot Jobs
:) Latest Articles
Follow
Can you write down some syntax for Razor in MVC3
Question Posted on 11 May 2012
Home
>>
DotNet
>>
MVC
>>
Can you write down some syntax for Razor in MVC3
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
0
0
Input Your Comments Or suggestions(If Any)
Name
Email
(optional)
Comments
Other Important Questions
How to create Razor enable application in MVC3
Can you write down some syntax for Razor in MVC3
Basic diagram of MVC
Different MVC version with there features
Could not load type System.Web.Mvc.ViewPage in asp.net MVC2
Top Searches:
asp net questions
vb net questions
sql query
uddl questions
class
javascript Questions
sharepoint interview questions and concept
silverlight questions and concept
wcf questions
beans
general knowledge
ajax questions
PHP
|
Biztalk
|
Testing
|
SAP
|
HR
|
Privacy policy |
Terms and Conditions
| Blog
If the copyright of any questions or content or syntax belong to you email us we will remove that(info@crackyourinterview.com or crackyourinterview2018@gmail.com)
Home
About Us
GroupChat
Sitemap
Feedback
Contact us