How to access the elements within an in WebBrowser in C#.NET?
Asked
Active
Viewed 1,498 times
3 Answers
1
try this
webBrowser1.Document.GetElementById("idName").SetAttribute("value") = "ddddd" ;
var stuff=webBrowser1.Document.GetElementById("idName").GetAttribute("attribute");
it works for me when I need to get/set control data and get any html element value
Luiscencio
- 3,855
- 13
- 43
- 74
0
Generally, you can't. C# and .NET are typically used in frameworks like ASP.NET to produce the content that is consumed by the browser. This happens on the server-side.
If .NET is installed on the client, then you can host a Windows Forms control in an HTML document in Internet Explorer but this is very, very non-standard, and I'd advise heavily against doing so.
casperOne
- 73,706
- 19
- 184
- 253
-
@casper I think he is talking about the WebBrowser control for Winforms – Shoban Feb 19 '10 at 19:57
0
As far as I understand you can access the controls inside the webbroswer control using the following code
WebBrowser1.Document.GetElementById("controlId").
Is this what you are looking for?
Additionally this discussion in daniweb might be of some interest to you.
Shoban
- 22,920
- 8
- 63
- 107
-
What did you mean by it did not help? How did it not help you? I have a similar application and it works for me. Its not an iframe though – Shoban Feb 19 '10 at 20:00