0

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

2 Answers 2

1

I answered a similar question. Check this : simulate Web Page keystroke

You can use the following code

WebBrowser1.Document.Forms("loginform").InvokeMember("submit");
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks, almost worked, but the ASP.NET validators stop you from directly calling form.submit()
May be you missed to fill in any form fields?
I think that the validators actually stop the form.submit event from firing as you get no message saying fields aren't filled out like you would when you press the button normally.
0

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");

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.