invoke 按钮点击_为什么不能我使用`Invokemember(QUOT;按一下[)`点击我的按钮编程?...

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:

/*

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"});/*]]>*/

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?

解决方案private const string STR_Field_userid = "field_userid";

private const string STR_Field_password = "field_password";

private const string STR_Submit = "submit";

document.GetElementById(STR_Field_userid).InnerText = UserId;

document.GetElementById(STR_Field_password).InnerText = Password;

document.Forms[0].InvokeMember(STR_Submit);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值