Click here to Skip to main content
15,913,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi everybody
i have a web page thats i use web browser contorl to go throw this web page using windows form there is a gridview with button in this page How can i access this button click using web browser control ??
i use this code but it doesn't do anything it doesn't carryout grid button click ??

What I have tried:

C#
private void gridview1_Click(object sender, EventArgs e)
        {

            if ((gridview1.Columns.View).FocusedValue == "edit")
            {
      
                if (webBrowser1.Url.PathAndQuery == ("web page url"))
                {

                    if (webBrowser1.Document != null)
                    {
                        HtmlElementCollection theElementCollectionChildNext = webBrowser1.Document.GetElementsByTagName("input");
                        foreach (HtmlElement elChild in theElementCollectionChildNext)
                        {
                            if (elChild.InnerText == "edit")
                            {
                                elChild.InvokeMember("click", null);
                                break;
                            }
                        }
                    }

               

                    simpleButton1.Text = "edit";

                }
            }

        }
Posted
Updated 4-Oct-16 9:10am
v2
Comments
[no name] 27-Sep-16 11:24am    
And what did you find when you stepped through your code using the debugger?
MR.alaa 27-Sep-16 13:23pm    
windows gridbutton click fire and it doesn't fire gridbutton in html page
[no name] 27-Sep-16 21:00pm    
Okay good. In other words, you didn't debug your code. Well then, learn to use the debugger, step through your code, then you might be able to update your not-a-question with some proper details about your problem.
MR.alaa 28-Sep-16 0:21am    
i use my debugger and i find that it coudnt reach or click the button in side html gridview beacuse all button html element are the same style and propety they are only different in element javascript:__doPostBack in other words
How to Fire __dopastback() in Winform's Webbrowser Control

1 solution

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



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