Saturday, 23 November 2013

ActionLink in HTML Helper Class in MVC

ActionLink in HTML Helper Class in MVC

ActionLink is used to generate hyperlink in MVC using HTML Helper Class.

For Example:-

@Html.ActionLink("Login","Welcome")

In this example Login is the Text which shows on link and Welcome is the view on which it will redirected when we click on this actionlink.

Actionlink method also allows us to bind any data on this link. 
We can access this data on redirected page.

@Html.ActionLink("Login", "Welcome", new { UserId = "isha123" })

In this example I bound data using name UserId. I can access this id on Welcome view as a parameter.

public ActionResult Welcome(string UserId)
        {
            Response.Write("Hello " + UserId);

            return View();
        }

In this way we can bind data on this actionlink which we can access on the redirected page.


5 comments:

  1. http://www.webtrackker.com/php_Training_Course_institute_noida_delhi.php

    ReplyDelete
  2. Internship & Recruitment Program for MCA students
    Webtrackker also provide the 6 Month/ weeks industrial training / Internship & Recruitment Program for MCA students in Java, dot net, Web designing, web developments, Angular.js, Node.js, Hybrid apps, computer networking, Plc Scada, Auto cad, All modules in ERP sap, sap mm, sap fico. Php, Oracle Dba, networking etc for MCA, BCA, B.Tech Students.
    Webtrackker Technologies
    B-47, Sector- 64
    Noida- 201301
    Phone: 0120-4330760, 8802820025
    Email: Info@Webtrackker.Com
    Web: www.webtrackker.com

    ReplyDelete
  3. Paris airport transfer - Parisairportransfer is very common in Paris that provides facilities to both the businessmen and the tourists. We provide airport transfers from London to any airport in London and also cruise transfer services at very affordable price to our valuable clients.

    Paris taxi
    Paris airport shuttle
    paris hotel transfer
    paris airport transfer
    paris shuttle
    paris car service
    paris airport service
    disneyland paris transfer
    paris airport transportation
    beauvais airport transfer
    taxi beauvais airport
    taxi cdg airport
    taxi orly airport

    ReplyDelete