"2017-05-21" webform cross-page value, C # service-side Jump page, button's OnClientClick property, JS getattribute and hyperlinks Click the pop-up alert box.

Source: Internet
Author: User
Tags server memory

One, cross-page values and values:

1, Querystring-url transfer value, address transfer value

Advantages and disadvantages: Do not occupy server memory, confidentiality is poor, transmission length is limited.

By jumping the page path to pass the value, the way:

href= "Address? Key=value&key=value" can pass multiple values with &.

In this way, the value to be passed to the page to jump to.

2, cross-page value:

Value on the C # code service side of the page that jumps to

Used: String value = request["key"];

Second, C # end page jump

Current page Jump:

response.redirect ("url"); You can also send a value in this jump address.

To open a new page window:

Response.Write ("<script>window.open (' default2.aspx ', ' _blank ');</script>");

Response.Write () prints the contents of the parentheses intact to the top of the HTML page. Inside can put JS, the above example is through JS to realize the opening of a new page.

OnClientClick Property of button

The OnClientClick property is used to set a client script to run when the Button control is clicked.

<asp:button id= "Button1" onclientclick= "return Buttonisok ()" runat= "server" text= "register"/>

The OnClientClick property of the button control controls the commit of the button, the property value is true to be committed, and the property value is False is not committed.

Buttonisok () is a method written in JS that only returns TRUE or False. You can implement the submit function of the control button.

JS Knowledge Point review:

button Click event: Opens a new page with no menu, no navigation bar, width 450 High 500 , the address is update.aspx and passes a value. This value is obtained by a custom attribute ' bh ' of this button

document.getElementById ("Btn1"). Onclick=function () {

window.open ("update.aspx?i=" + this.getattribute (' bh '), "_blank", "toolbar=no menubar=no width=450 height=500")

}

Button code: <input id= "BTN1" type= "button" bh= "<% #Eval (" Ids ")%>" value= "edit"/>

Hyperlinks:

do you want to delete the popup box? Click OK to connect to the address that is written in the href.

<a onclick= "return confirm (' Delete <% #Eval (" nickname ")%>? ' href= ' delete.aspx?i=<% #Eval ("Ids")%> "> Delete </a>

"2017-05-21" webform cross-page value, C # service-side Jump page, button's OnClientClick property, JS getattribute and hyperlinks Click the pop-up alert box.

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.