jQuery在LinkBut​​ton上调用__doPostBack

Mar*_*man 5 asp.net jquery postback linkbutton dopostback

我有一个LinkBut​​ton,我需要执行单击以导致回发.实际的链接目标是:

javascript:__doPostBack('ctl00$c1$btnRefreshGrid','');

单击该链接会执行回发,由代码隐藏中的断点验证.粘贴javascript:__doPostBack('ctl00$c1$btnRefreshGrid','')在浏览器的地址栏中也可以起到同样的效果.

我尝试了以下但完全没有效果:

__doPostBack('ctl00$c1$btnRefreshGrid','');    
$('#ctl00$c1$btnRefreshGrid').click();
$('#ctl00$c1$btnRefreshGrid').trigger('click');
eval($('#ctl00$c1$btnRefreshGrid').attr("href"));
Run Code Online (Sandbox Code Playgroud)

我同时使用尝试<%= btnRefreshGrid.UniqueID %><%= btnRefreshGrid.ClientID %>产生的选择.

Mar*_*ive 4

你很接近,这在 Firefox 中有效:

 function clickMyButton() {
   javascript:__doPostBack('<%= MYBUTTONID.UniqueID %>','')
};
Run Code Online (Sandbox Code Playgroud)