Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,
Am trying to click go button in one website through c# win application using axwebbrowser. the button is having


XML
<td>
            <input type="image" name="ctl00$MultiProvider1$Imagebutton1" id="ctl00_MultiProvider1_Imagebutton1" src="../images/buttons/btn_go_ag.gif" alt="Go" style="border-style:None;height:17px;width:45px;border-width:0px;" />
        </td>


it is not having onclick event to fire.What my problem is after clicking the go button the page is not loading and it going for the default page.so is there any way to click the button.
Posted
Updated 9-Jul-13 1:06am
v2
Comments
manimaran4187 9-Jul-13 7:09am    
Can any one please tell me any alternate way to click the button please. I currently used

htmlinputelement img =(htmlinputelement)myhtmldocument.getelementsbyid("......");
img.focus();
img.click();


not worked pls can any one give solution pls
manimaran4187 9-Jul-13 7:13am    
Is it possible to click button without having onclick event ?

Since an input tag makes the most sense if it is actually surrounded by a corresponding form tag you should rather try to call the submit method of the form. If it is your intend to actually submit the form, that is.

See this example: Form submit() Method Demonstration[^]

Cheers!
 
Share this answer
 
v2
Comments
manimaran4187 9-Jul-13 9:02am    
Hi Manfred,
Am using a web browser in my application.Through web browser am trying to click the button .Am writting my code under axwebbrowserDocumentComplete.So am not able to click it.



private void axWebBrowser1_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
{

if (myHTMLDocument.readyState == "complete")
{
if (!Provider.Trim().Equals(""))
{

HTMLInputElement InputElement1 = (HTMLInputElement)myHTMLDocument.all.item("ctl00$MultiProvider1$providerDropDown", 0);
InputElement1.value = Provider;


HTMLDivElement DropDown = (HTMLDivElement)myHTMLDocument.getElementById("ctl00_MultiProvider1_providerDropDown_DropDown");
DropDown.click();


HTMLInputElement submitButton = (HTMLInputElement)myHTMLDocument.all.item("ctl00$MultiProvider1$Imagebutton1",0);
submitButton.focus();
submitButton.click();
}
}
}
manimaran4187 9-Jul-13 11:55am    
Please any one can tell near solution to my problem .................
by using background worker and using thread concept i have solved my problem .Any way thanks for manfred for trying to solve my prob.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900