Provides a summary of examples of Brushless newest linkage and refresh the association examples.
Iframe implements brushless newest Linkage
The refreshing of iframe is actually a partial refresh. the scroll bar of the status bar will still scroll, but the page will not flash. This is an old technology, the processing data is slow. In this example, two pages are required: index. aspx and frame. asretrial, index. aspx is used to display the interface, with an iframe mark pointing to frame. the aspx page is used to display results.
Index. aspx front-end 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">
Front-end code of frame. aspx:
<% @ 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 ("Huangshi"); 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 refreshing
Front-end 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 city ;}}
CallBack
Front-end 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 refreshing
This example also uses two pages: oec203index. aspx and datapage. aspx. datapage. aspx, which are mainly used to send data to be displayed.
. Aspx page front-end 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 is all the content of this article. I hope you will like it.