Improvements to the hyperlink control in net4.0-ASPnet (supports route jump)

Source: Internet
Author: User

Web developers must be very familiar with the hyperlink control. The code generated on the client is a tag. The hyperlink control in aspnet4 has made some improvements compared with previous versions, so it can better support URL rewriting, the following is an example of improving URL rewriting in net4.0 --- ASPnet to explain the new hyperlink function.

1. Add a hyperlink control to the default. aspx page of the Project, right-click the control in the design view, select properties, and select expresstions in the Properties window, for example:

2. Click the three dots on the right. In the pop-up dialog box, set as follows:

Set routename to productdetail to direct the link to the test. ASPX page, because test. aspx is used to set the physical file of the Route named productdetail in global. asax. Routevalus is the configuration parameter. The category and name here are also configured in global. asax.

3. Click OK and switch to the Code view. The Code is as follows:

<Asp: hyperlink id = "hyperlink1" runat = "server" navigateurl = "<% $ routeurl: routename = productdetail, Category = computer, name = ThinkPad %> "> test page </ASP: hyperlink>

4. Set default. aspx as the start page and press F5 to run. Click the test page Link to go to the test. ASPX page, for example:

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.