crackyourinterview.com


To improves our performance please Like Share Subscribe(Will boost us)

Can you write down some syntax for Razor in MVC3
Question Posted on 11 May 2012Home >> 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



.


Most Visited Questions:-

Deep Learning Questions Answers
Below are the different Deep Leaning Questions and answer a More...

Continuous Integration Questions Answers
Below are the 20 odd questions for CI or Continuous Integra More...

Derived relationships in Association Rule Mining are represented in the form of __________.
Derived relationships in Association Rule Mining are repres More...

What is Gulpjs and some multiple choice questions on Gulp
Gulpjs is an open source whihc helps in building Javascript More...

Microservices Architecture Questions Answers
Below are the different questions on Microservices Architec More...




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






@2014-2022 Crackyourinterview (All rights reserved)
Privacy Policy - Disclaimer - Sitemap