Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58
?
?<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(); } }
1,eventTarget? 代表控件ID, eventArgument代表控件对应的数据 可用: Request.Form[“__EVENTTARGET”] 形式获取ID,参数。特别在用CheckBoxList时,在其OnSelectedIndexChanged事件中可通过如下方式获取点击的CheckBox:
?? ? string ClickedItem = Request.Form[“__EVENTTARGET”];//得到用户点击的是哪个
????? ClickedItem = ClickedItem.Split(‘$’)[1];//进行拆分处理
???? chkDepartlist.Items[StringHelper.FormatBlankStringToint(ClickedItem)].Value) //当前点击的CheckBox2, Button与ImageButton不可通过上述方式得到ID,因为他们没有调用 _doPostBack 方法,是直接submit的方式
?? 不过可用如下方式替换:
?? ???? <input?type=”button”?id=”Button2″?value=”Press?me”?onclick=”DoPostBack()”?/>?? <!–显示调用–>
??? ??? ?<script?language=”javascript”?type=”text/javascript”> ?
?? ??? ??? ??? ?function?DoPostBack()? { ??__doPostBack(‘Button2′,’My?Argument’);????? } ?
?? ??? ??? ?</script> string?passedArgument?=?Request.Params.Get(“__EVENTARGUMENT”);