在_doPostBack JavaScript对象预期的错误('','') [英] JavaScript Object Expected error in _doPostBack('','')
问题描述
我不断收到我的网页脚本中的预期的目标错误,当我点击按钮。
我用火错误调试,并传递到JavaScript方法的id是正确的ID和的document.getElementById(一)
查找按钮。误差保持在 _doPostBack
发生。这能造成的,因为该按钮是在GridView单元格的模式弹出里面,在GridView是一个更新面板内。
I keep getting the 'Object Expected' error within my page script when I click the button.
I've debugged using fire-bug and the id passed to the JavaScript method is the correct id and document.getElementById(a)
finds the button. The error keeps occurring in the _doPostBack
. Can this be caused because the button is inside a modal popup in a gridview cell, and the gridview is inside a update panel.
有关完整code请参阅本previous问题<一href=\"http://stackoverflow.com/questions/10969690/button-click-event-on-modal-popup-inside-a-grid-view-not-firing\">event没有发射我张贴和解决。
For complete code please see this previous question event not firing I posted and resolved.
我现在还在使用JavaScript的原因是没有这并没有发生在GridView.RowCommand后返回的事件。
The reason I'm still using the JavaScript is the Post-Back event in the GridView.RowCommand did not occur without this.
有没有来替代?
在code:
function addAcc(a) {
var btn = document.getElementById(a); //get the button, not necessary but safer
alert(a); //To see the button id
_doPostBack(btn.id, ''); //do the postback so RowCommand Fires in code behind
};
&LT; ASP:按钮的ID =btnAddAcc=服务器文本=添加帐户
的OnClientClick =JavaScript的:addAcc(this.id)/&GT;
谢谢你的任何解决方案和想法。
问候
Thank you for any solutions and ideas. Regards
推荐答案
在dopostback方法是用两个下划线而不是一个,像
the dopostback method is with two underscores not one, like
__doPostBack
所以你的电话是这样的:
so your call is like:
__doPostBack(btn.id, '');
而不是
_doPostBack(btn.id, '');
这篇关于在_doPostBack JavaScript对象预期的错误('','')的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!