当网页托管在WebBrowser控件中时,如何单击ASP.NET Web窗体的按钮
我在网页中有一个标准的ASP.NET Web表单,并且此页面托管在带有WebBrowser控件的.NET Winform中.使用C#如何控制WebBrowser控件提交ASP.NET表单?(例如,以某种方式从Winform中单击"按钮?)
I have a standard ASP.NET web form in a web page, and this page is hosted in a .NET Winform with a WebBrowser Control. Using c# how do I control the WebBrowser Control to submit the ASP.NET form? (eg somehow "clicking" on the button from the Winform?)
更新:为了使事情复杂化,我们使用了ASP.NET验证程序,这些验证程序似乎使简单的document.forms(0).submit()无效
Update: to complicate things we have the ASP.NET validators which seem to make simple document.forms(0).submit() not work
由于ASP.NET验证程序的复杂性以某种方式弄乱了正常的form.submit()流,因此必须调用提交按钮的click方法:>
Because of the complication of the ASP.NET validators somehow messing with the normal form.submit() flow the submit button's click method had to be called:
WebBrowser1.Document.getElementById("mybutton").InvokeMember("click");