在gridview Linkbutton有不同的id和做回发事件目标,它应该是相同的

本文关键字:目标 事件 Linkbutton gridview id | 更新日期: 2023-09-27 17:52:38

href="javascript:__doPostBack('grid1$ctl02$lkbDelete','')"
id="grid1_lkbDelete_0"

完整链接为:

<a onclick="javascript:return PopupDialouge(&#39;&lt;b>Are you sure you want to delete this Record?&lt;/b>'nbecause all Process related comments for this record'nwill be deleted.&#39;,&#39;Confirmation&#39;,&#39;Delete&#39;,&#39;Cancel&#39;,this,&#39;ui-icon-alert&#39;);" id="grid1_lkbDelete_0" name="lkbDel" href="javascript:__doPostBack(&#39;grid1$ctl02$lkbDelete&#39;,&#39;&#39;)">Delete</a>

实际上我想通过捕获eventargument来捕获custom postback,但这里我只能获得事件目标,它应该与事件目标相同,但它不同,所以我不能导致manual postback

在gridview Linkbutton有不同的id和做回发事件目标,它应该是相同的

我自己做的,我把gridview客户端模式从静态改为自动,然后我把下划线_从linkbtn id替换为美元$,然后它工作了。

var ctlid=this.id.replace(/_/g,'$');
function postback(){
__dopostback(ctlid,'');
}