You must Sign In to post a response.
  • Category: ASP.Net MVC

    What is @ in mvc 4 view

    hii I am new to mvc.I just want to know wht is @ in views like @Html.LabelFor,@using (Html.BeginForm

    and at many other places...
  • #737485

    Hai Shalini,
    There are 2 types of View Engines which are supported by MVC since the relase of MVC3:-
    1. Aspx engine
    2. Razor engine
    The Aspx engine is simple aspx pages where you can use all the asp.net type of programming while the Razor engine is the new for the MVC type of programming where the syntax is starts with '@'.
    So the Razor syntax is clean and we need not to write many things.
    @Html.LabelFor --> to get and display a label
    @using (Html.BeginForm...--> it shows that we have started some code for design with the using statement.
    So by considering all these things, this is the Razor syntax and we need to write it in the views.
    Hope it will be helpful to you.


    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com

  • #737490
    thank u so much sir

  • #737582
    @ is the new syantax symbol in MVC 4 which determine the start of the line code.

    The earlier version was <%%> which is now replaced with @ in MVC 4 ot required only start @ no need to have the symbol at the teriminating line as well.

    Thanks & Regards
    Anil Kumar Pandey
    Microsoft MVP, DNS MVM

  • #737737
    thank u sir

  • #760999
    Hi

    If you need show variables and controls you need use @ in Razor view at the same thing in aspx page means you can use <% also.

    Name : Dotnet Developer-2015
    Email Id : kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.


  • Sign In to post your comments