码迷,mamicode.com
首页 > 其他好文 > 详细

点击了一个link button,查看后台调用

时间:2017-12-01 15:16:03      阅读:273      评论:0      收藏:0      [点我收藏+]

标签:bsp   targe   pre   handle   custom   get   view   hidden   lib   

使用F12进行监视

本身是一个linkbutton,可以看到绑定了一个JavaScript

<a id="gvStaticConnection_ctl02_fresh" href="javascript:__doPostBack(‘gvStaticConnection$ctl02$fresh‘,‘‘)">Refresh</a>

 

然后在element中搜索JavaScript,发现如下代码。

在form中嵌套了2个div,中间是一段JavaScript代码。

 

<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="">
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJMzkwNjgzNzg1ZBgBBRJndlN0YXRpY0Nvbm5lY3Rpb24PPCsADAEIAgFkMpKk471Gv2kC36HGZDQi3IDHc+gD0MIZt2NfaV1jqgg=">
</div>

 

<script type="text/javascript">
//<![CDATA[
var theForm = document.forms[‘form1‘];
if (!theForm) {
    theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>

 

<div>

    <input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="A00F45E7">
    <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEdAAuNjij2g8HmJzHvpgbbF2UABG/bDdI74QPKSd1GbZA1p63BzPafSbjFZYr7YmO2hZLYOUOqiZmmlUGNRTBh5x9UeQJeCn5nS3Bfxy0+ElgI+9rHUHz/Y3DEd+XunHJ2rU6E4dAYu7eDiCYafdT3BS0Dr0sw6HJovU56ooP5DqFtdDuddnR7NwTASVzh66LqbcoTbXzLtoGNIRcsVOw3Kqtt1UYiKMifYW4rKipFYzjzs/AhN/5B3flrm+45Mi+1IzazoFp37V/4pb3o2NkeiLIB">
</div>

 

 

 

https://stackoverflow.com/questions/3591634/how-to-use-dopostback

simply said, it is used mainly by controls with AutoPostBack property

http://www.dotnetspider.com/resources/189-AutoPostBack-What-How-works.aspx

if you want to implement autopostback for your custom control, then you need to implement IPostBackDataHandler

 

https://stackoverflow.com/questions/5376055/what-is-the-meaning-of-dopostback-function-and-when-is-it-used

 

点击了一个link button,查看后台调用

标签:bsp   targe   pre   handle   custom   get   view   hidden   lib   

原文地址:http://www.cnblogs.com/chucklu/p/7942074.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!