̽Ë÷Asp.netµÄPostback»úÖÆ
/* from: http://www.techmango.com/blog/article/DotNet/Explore_Asp_net_postback_mechanism.htm */
__doPostBack×÷ΪÔÚasp.netÖÐÒ»¸öºÜºËÐĺÜÖØÒªµÄ²¿·Ö,ÎÒÃÇÓбØÒªÉîÈëÁ˽âÒ»ÏÂ.
Æäʵ,__doPostBackÊÇÒ»¸öºÜ¼òµ¥µÄ½Å±¾º¯Êý.´úÂëÈçÏÂ:
//__doPostBack<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /><input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />function __doPostBack(eventTarget, eventArgument) {if (!theForm.onsubmit || (theForm.onsubmit() != false)) {theForm.__EVENTTARGET.value = eventTarget;theForm.__EVENTARGUMENT.value = eventArgument;theForm.submit();}}
ÔÀ´ÊÇÔÚsubmitÉÏ×öÎÄÕ°¡.microsoft³ÊÏÖ¸øÎÒÃǵľÍÊÇÕâÖÖ¾«ÇɵÄ˼ά!
ÎÒ¿´µ½,asp.netÏÖÔÚÒ³ÃæÉÏÌí¼ÓÁËÁ½¸öhidden input,ÕâÁ½¸öinput·Ö±ðÓÃÀ´´æ·Å´¥·¢postbackµÄcontrolµÄIDºÍ²ÎÊý.Õâ¾ÍÊÇÎÒÃǴ󲿷ÖÈËÈÏʶµ½µÄ:
__doPostBack(obj1,obj2)µÄµÚÒ»¸ö²ÎÊýÊǿؼþID,µÚ¶þ¸ö²ÎÊýÊÇpostbackµÄ²ÎÊý.È»ºó¾Í¿ÉÒÔÔÚºǫ́ÓÃRequest.Form["__EVENTTARGET"]ºÍ Request.Form["__EVENTARGUMENT"]È¡µÃ¿Ø¼þIDºÍ²ÎÊý.
²»¹ý,ÁíÍâҪעÒâµÄ¾ÍÊÇasp.netµÄwebcontrolsÖÐ,Button»òÆäËü***Button,ÈçImageButton¾ÍÌØÊâÁË,ËüÃDz»ÊÇÀûÓà __doPostBackÀ´ÊµÏÖpostbackµÄ.ΪʲôÕâÑù,¿ÉÄÜÒòΪButtonÔÚhtmlÖб¾À´¾ÍÊÇÓд¥·¢submitʼþµÄ¹¦ÄÜ°É.asp.net²»¹ýÊÇÒªÁîÔÀ´htmlÖÐһЩ²»ÄÜ´¥·¢submitµÄ¶«Î÷submit,²ÅŪ³öÁË__doPostBackÀ´ÊµÏÖ°É.
ËùÒÔÈç¹ûÊÇButtonµÄpostback,ÔÚºǫ́ÊDz»ÄÜÓÃRequest.Form["__EVENTTARGET"]ºÍRequest.Form["__EVENTARGUMENT"]È¡µÃ¿Ø¼þIDºÍ²ÎÊýµÄ.ÄÇô,ÔõôȡÄØ?¿´´úÂë:
//È¡Buttonforeach (string str in Request.Form){ Control c = Page.FindControl(str); if (c is Button) { control = c; break; }}
ÉÏÊöд·¨¿ÉÒÔÔÚºǫ́ÕÒµ½Button.ÔÚButtonµÄÌá½»¹ý³ÌÖÐ,Button»á½«Button±¾ÉíµÄID×÷ΪRequest.FormµÄÒ»¸öKey£¬ËüµÄValueÊÇButtonµÄ TextÊôÐÔÖµ£¬»Ø´«¸ø·þÎñÆ÷.ËùÒÔ¿ÉÒÔÔÚºǫ́ѻ·Form.KeysÈ¡µ½ËùÌá½»µÄButton,ÒÔÖ´ÐÐÏàÓ¦µÄº¯Êý.ImgButtonÒ²²î²»¶à,²»Í¬¾ÍÔÚÓÚ£¬Ëü²»ÊÇÓÃImageButtonµÄID×÷ΪRequest.FormµÄKey£¬ËüÊÇÓÃImageButtonµÄID¼ÓÉÏ.xºÍ.y×÷ΪKey£¬ÔÚ Request.FormÌí¼ÓÁ½ÉϼüÖµ¶Ô£¬ÕâÁ½¸ö¼üÖµÓ¦¸ÃÊǶÔÓ¦ImageButtonµÄͼƬ´
Ïà¹ØÎĵµ£º
protected void Page_Load(object sender, EventArgs e)
{
}
#region OnPreInit µÚÒ»²½
protected override void OnPreInit(EventArgs e)
{
//¼ì²é ......
+++ PassDatatableByCache01.aspxÒ³Ãæ
++ ҳ̨´úÂëÈçÏ£º
<asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="ÓÃCache´«Êý¾Ý¼¯"></asp:Button>
++ ºǫ́´úÂëÈçÏ£º
protected void Button1_Click(object sender, EventArgs e)
{
string connStr = "Data Source=ora11g;uid=sc ......
²Î¿¼ http://topic.csdn.net/t/20040510/19/3051316.html
¿ªÊ¼
ÔËÐÐ
dcomcnfg
×é¼þ·þÎñÒ»ÏîÖÐÑ¡ÔñDcomÅäÖã¬ÕÒµ½Microsoft excelÓ¦ÓóÌÐò£¬²ì¿´ÊôÐÔ
°²È«Ñ¡ÏÖУ¬Æô¶¯È¨Ï޺ͷÃÎÊȨ ......
µÚÒ»ÖÖ²¥·ÅÆ÷´úÂ룺
<object title="dvubb" align="middle" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" class="object" id="MediaPlayer" width="480" height="360">
<param name="AUTOSTART" value="true"/>
<param name="ShowStatusBar" value="-1"/>
<param name="Filename" va ......