How to implement page jumps in ASP.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.