Implement no Refresh linkage example Rollup _javascript tips

Source: Internet
Author: User

Non-flush linkage for IFRAME implementation

The no refresh of the IFRAME is in fact a local refresh, the status bar scroll or will scroll, but the page will not blink, this is a relatively old technology, in the processing of data two times will be relatively slow, in this case requires two pages: Index.aspx and FRAME.ASAPX, Index.aspx is used to display the interface, which has an IFRAME tag pointing to the Frame.aspx page to display the result
Index.aspx Foreground Code

<%@ Page language= "C #" autoeventwireup= "true" codefile= "Index.aspx.cs" inherits= "_default"%> <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">  

Frame.aspx's foreground code:

<%@ Page language= "C #" autoeventwireup= "true" codefile= "Frame.aspx.cs" inherits= "MyFrame"%> <!

DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
 
 

Frame.aspx Background code:

Using System;
Using System.Data;
Using System.Configuration;
Using System.Collections;
Using System.Web;
Using System.Web.Security;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.WebControls.WebParts;

Using System.Web.UI.HtmlControls; Public partial class Myframe:System.Web.UI.Page {protected void Page_Load (object sender, EventArgs e) {string
    Pro = request.querystring["Pro"];
        Switch (PRO) {case "Hubei": this.ddlCity.Items.Clear ();
        THIS.DDLCITY.ITEMS.ADD ("Wuhan");
        THIS.DDLCITY.ITEMS.ADD ("Huanggang");
        THIS.DDLCITY.ITEMS.ADD ("Yellowstone");
        THIS.DDLCITY.ITEMS.ADD ("Xiangfan");
      Break
        Case "Hebei": This.ddlCity.Items.Clear ();
        THIS.DDLCITY.ITEMS.ADD ("Shijiazhuang");
        THIS.DDLCITY.ITEMS.ADD ("Tangshan");
        THIS.DDLCITY.ITEMS.ADD ("Chengde");
        THIS.DDLCITY.ITEMS.ADD ("Handan");
      Break
        Case "Guangdong": this.ddlCity.Items.Clear ();
        THIS.DDLCITY.ITEMS.ADD ("Guangzhou"); This.ddlCity.ItemS.add ("Foshan");
        THIS.DDLCITY.ITEMS.ADD ("Shenzhen");
        THIS.DDLCITY.ITEMS.ADD ("Zhuhai");
      Break
        Case "Henan": this.ddlCity.Items.Clear ();
        THIS.DDLCITY.ITEMS.ADD ("Zhengzhou");
        THIS.DDLCITY.ITEMS.ADD ("Xinxiang");
        THIS.DDLCITY.ITEMS.ADD ("Anyang");
        THIS.DDLCITY.ITEMS.ADD ("Xinyang");

    Break

 }
  }
}

JavaScript No Refresh Linkage

Front page code:

<%@ Page language= "C #" autoeventwireup= "true" codefile= "Index.aspx.cs" inherits= "Jacascript_default"%> <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">  

Background code:

Using System;
Using System.Data;
Using System.Configuration;
Using System.Collections;
Using System.Web;
Using System.Web.Security;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.WebControls.WebParts;
Using System.Web.UI.HtmlControls;

Using System.Text;
    Public partial class Jacascript_Default:System.Web.UI.Page {protected void Page_Load (object sender, EventArgs e) {
    StringBuilder myscript = new StringBuilder (); MyScript.
    Append ("function city () {\ n"); MyScript.
    Append ("var Ddlpro=document.getelementbyid (' Ddlpro '); \ n"); MyScript.
    Append ("var pro=ddlpro.options[ddlpro.selectedindex].innertext;\n"); MyScript.
    Append ("var Pro=document.getelementbyid (' Txtpro '). value;\n"); MyScript.
    Append ("switch (PRO) {\ n"); MyScript.
    Append ("Case ' Hubei ': \ n"); MyScript.
    Append ("Filldata" + getcitystr ("Hubei") + "'); \ n"); MyScript.
    Append ("break;\n"); MyScript.
    Append ("Case ' Hebei ': \ n"); MyScript. Append ("Filldata" + getcitystr ("Hebei") + "");\ n "); MyScript.
    Append ("break;\n"); MyScript.
    Append ("Case ' Guangdong ': \ n"); MyScript.
    Append ("Filldata" + getcitystr ("Guangdong") + "'); \ n"); MyScript.
    Append ("break;\n"); MyScript.
    Append ("Case ' Henan ': \ n"); MyScript.
    Append ("Filldata" + getcitystr ("Henan") + "'); \ n"); MyScript. Append ("Break;}"
    \ n "); MyScript.

    Append ("}\n"); Page.ClientScript.RegisterClientScriptBlock (typeof (String), "City", MyScript.

  ToString (), true);
    private string Getcitystr (String pro) {String city = "";
        Switch (PRO) {case "Hubei": City = "Wuhan, Huanggang, Huangshi, Xiangfan";
      Break
        Case "Hebei": City = "Shijiazhuang, Tangshan, Chengde, Handan";
      Break
        Case "Guangdong": City = "Guangzhou, Foshan, Shenzhen, Zhuhai";
      Break
        Case "Henan": City = "Zhengzhou, Xinxiang, Anyang, Xinyang";
    Break
  return to City;

 }
}


Callback No Refresh linkage

Foreground code:

<%@ Page language= "C #" autoeventwireup= "true" codefile= "Index.aspx.cs" inherits= "Callback_default"%> <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">  

Background code:

Using System;
Using System.Data;
Using System.Configuration;
Using System.Collections;
Using System.Web;
Using System.Web.Security;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.WebControls.WebParts;
Using System.Web.UI.HtmlControls;

public partial class Callback_default:system.web.ui.page,icallbackeventhandler
{
 private string _data;
 protected void Page_Load (object sender, EventArgs e)
 {

  }

 ICallbackEventHandler member
}

Ajax No Refresh Linkage

This example also uses two pages: Oec203index.aspx and datapage.aspx. Datapage.aspx is primarily used to echo the data to be displayed
. aspx page foreground code:

<%@ Page language= "C #" autoeventwireup= "true" codefile= "Index.aspx.cs" inherits= "Ajax_default"%> <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">  

Datapage.aspx Background code:

Using System;
Using System.Data;
Using System.Configuration;
Using System.Collections;
Using System.Web;
Using System.Web.Security;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.WebControls.WebParts;
Using System.Web.UI.HtmlControls;

public partial class Ajax_datapage:System.Web.UI.Page
{
  protected void Page_Load (object sender, EventArgs e)
  {
    String pro = request.querystring["Pro"];
    Response.Clear ();
    Switch (PRO)
    {case
      "Hubei":
        Response.Write ("Wuhan, Huanggang, Huangshi, Xiangfan");
        break;
      Case "Hebei":
        Response.Write ("Shijiazhuang, Tangshan, Chengde, Handan");
        break;
      Case "Guangdong":
        Response.Write ("Guangzhou, Foshan, Shenzhen, Zhuhai");
        break;
      Case "Henan":
        Response.Write ("Zhengzhou, Xinxiang, Anyang, Xinyang");
        break;
    }}}

The above mentioned is the entire content of this article, I hope you can enjoy.

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.