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?)
Update : to complicate things we have the ASP.NET validators which seem to make simple document.forms(0).submit() not work
I answered a similar question. Check this : simulate Web Page keystroke
You can use the following code
WebBrowser1.Document.Forms("loginform").InvokeMember("submit");
由于ASP.NET验证器的复杂性,以某种方式弄乱了正常的form.submit()流,因此必须调用提交按钮的click方法:
WebBrowser1.Document.getElementById("mybutton").InvokeMember("click");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.