.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?

enter image description here

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

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -