Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • Razor Engine in MVC

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 49
    Comment on it

    While working with MVC you dont see # tags which denotes aspx engine you will always see @ which denotes the razor engine.

    So writing HTML in this engine is different as compared to aspx engine

    @model MVC_Demo.Models.EmployeeModel
    
    @{
        ViewBag.Title = "RegisterEmployeeDetails";
    }
    
    <h2>RegisterEmployeeDetails</h2>
    
    <div>
        <h4>EmployeeModel</h4>
        <hr />
        <dl class="dl-horizontal">
            <dt>
                @Html.DisplayNameFor(model => model.FirstName)
            </dt>
    
            <dd>
                @Html.DisplayFor(model => model.FirstName)
            </dd>
    
            <dt>
                @Html.DisplayNameFor(model => model.MiddleName)
            </dt>
    
            <dd>
                @Html.DisplayFor(model => model.MiddleName)
            </dd>
    
            <dt>
                @Html.DisplayNameFor(model => model.LastName)
            </dt>
    
            <dd>
                @Html.DisplayFor(model => model.LastName)
            </dd>
    
            <dt>
                @Html.DisplayNameFor(model => model.PhoneNo)
            </dt>
    
            <dd>
                @Html.DisplayFor(model => model.PhoneNo)
            </dd>
    
            <dt>
                @Html.DisplayNameFor(model => model.Address)
            </dt>
    
            <dd>
                @Html.DisplayFor(model => model.Address)
            </dd>
    
          
        </dl>
    </div>
    <p>
        @Html.ActionLink("Edit", "Edit", new { /* id = Model.PrimaryKey */ }) |
        @Html.ActionLink("Back to List", "Index")
    </p>
    

    Here you can see in HTML that  for labels we are writing Label DisplayFor

    .net

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: