.net - How do submit a form without clicking submit button BUT with code in (C# web browser control) -
hi there way submit form without clicking submit button?
keep in mind inside webbrowser1 control in c# . if click button in c# application should automatically submit form.
you can inject javascript code submits form page:
// on form load. htmlelement head = webbrowser1.document.getelementsbytagname("head")[0]; htmlelement scriptel = webbrowser1.document.createelement("script"); ihtmlscriptelement element = (ihtmlscriptelement)scriptel.domelement; element.text = "function submitform() { document.getelementbyid('formid').submit(); }"; head.appendchild(scriptel);
then invoke on button click:
// in button click handler webbrowser1.document.invokescript("submitform");
Comments
Post a Comment