为什么我不能使用“Invokemember(“click”)”以编程方式单击我的按钮?
我正在尝试通过 WebBrowserControl
从应用程序中的网站获取数据。我可以成功登录,但当我以编程方式调用 btnsearch.Invokemember("click")
时,我收到 JavaScript 错误。如果我以交互方式单击 WebBrowserControl
上的按钮,我不会收到任何错误,并且一切正常。
在 aspx 页面中,我有一个用于调用 Ajax 面板的 JavaScript 函数:
<script type="text/javascript">
/*<![CDATA[*/
window["ctl00_WorkSpace_ctlCustAVIHistory_ajxResultPanel"] = new RadAjaxPanelNamespace.RadAjaxPanel({ClientID:"ctl00_WorkSpace_ctlCustAVIHistory_ajxResultPanel",EnableOutsideScripts:false,EnablePageHeadUpdate:true,Url:"/app/ModuleCustomer/ViewAVITransactions.aspx",LoadingPanelID:"ctl00_WorkSpace_ctlCustAVIHistory_LoadingPanel1",ActiveElementID:"",ClientEvents:{OnRequestStart:"",OnRequestSent:"",OnResponseReceived:"",OnResponseEnd:""},FormID:"aspnetForm",UniqueID:"ctl00$WorkSpace$ctlCustAVIHistory$ajxResultPanel"});/*]]>*/
</script>
它生成一个 UniqueID。如果我们通过代码单击btnsearch
,则此唯一 ID 为空。
function onClickButton(rName)
{
if(validateData())
{
document.getElementById("ctl00_WorkSpace_ctlCustAVIHistory_hdnReset").value = "0";
ctl00_WorkSpace_ctlCustAVIHistory_ajxResultPanel.AjaxRequest("NewSearch"); ///these caling down function
}
}
RadAjaxPanelNamespace.RadAjaxPanel.prototype.AjaxRequest = function (eventArgument) {
this.AjaxRequestWithTarget(this.UniqueID, eventArgument);//this.UniqueID giving null from program click mouse click it is giving correct id
};
知道为什么会发生这种情况吗?
I am trying to fetch data from a website in my application through a WebBrowserControl
. I can successfully log in, but when I call btnsearch.Invokemember("click")
programmatically I receive a JavaScript error. If I click the button interactively on the WebBrowserControl
I receive no error and everything works fine.
In the aspx page I have one JavaScript function for calling an Ajax Panel:
<script type="text/javascript">
/*<![CDATA[*/
window["ctl00_WorkSpace_ctlCustAVIHistory_ajxResultPanel"] = new RadAjaxPanelNamespace.RadAjaxPanel({ClientID:"ctl00_WorkSpace_ctlCustAVIHistory_ajxResultPanel",EnableOutsideScripts:false,EnablePageHeadUpdate:true,Url:"/app/ModuleCustomer/ViewAVITransactions.aspx",LoadingPanelID:"ctl00_WorkSpace_ctlCustAVIHistory_LoadingPanel1",ActiveElementID:"",ClientEvents:{OnRequestStart:"",OnRequestSent:"",OnResponseReceived:"",OnResponseEnd:""},FormID:"aspnetForm",UniqueID:"ctl00$WorkSpace$ctlCustAVIHistory$ajxResultPanel"});/*]]>*/
</script>
It produces a UniqueID. If we click on btnsearch
through code this unique id is null.
function onClickButton(rName)
{
if(validateData())
{
document.getElementById("ctl00_WorkSpace_ctlCustAVIHistory_hdnReset").value = "0";
ctl00_WorkSpace_ctlCustAVIHistory_ajxResultPanel.AjaxRequest("NewSearch"); ///these caling down function
}
}
RadAjaxPanelNamespace.RadAjaxPanel.prototype.AjaxRequest = function (eventArgument) {
this.AjaxRequestWithTarget(this.UniqueID, eventArgument);//this.UniqueID giving null from program click mouse click it is giving correct id
};
Any idea why this happens?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)