1. The simplest way: hyperlinks
The following are connected to the HomeController controller under the SHARPL action method, as well as Baidu home page. The code is as follows:
1 <a href="home\sharpl"> Open sharpl</a>
1 <a href="http://www.baidu.com"> Open Baidu </a>
And you can add parameters to the URL and pass it to the action with the following code:
1--Front desk2<a href="/href/hreftest? city= Beijing &name=sharpl&age=18"> Click me and return to you with a string </a>3 //Backstage4 Public stringhreftest ()5 {6 varStu =NewStu ();7 This. Updatemodel (Stu);8 return string. Format ("{0}{1} years old, from {2}", Stu. Name, Stu. Age, Stu. City);9}
or use the HTML helper to generate the <a> element with the following code:
1 @Html. ActionLink ("nihao""here")
Note: Although in the "proficient in ASP. NET MVC4" book has a large number of use of HTML helper method, but in the actual project we seldom use, in the production process, will be designed and front-end design Good page, the programmer can registration, and the above code, the way is not conducive to registration, Not intuitive enough to determine the ID and class, and not use CSS styles very well.
2,window.location.
After completing the business rules for the current page, close the current page and open the specified page with the following code:
1 $ ("#btnBaidu"). Click (function () {2 "http:// www.baidu.com"; 3 });
Click the button, jump to Baidu home page.
You can also jump to the specified controller with the following code:
window.location='/home/thanks'
Good bye.
Source: http://www.cnblogs.com/SharpL/p/4675594.html
How to implement page jumps in ASP.