How to get the value of a SELECT HtmlElement in C# webBrowser control
Posted
by AndrewW
on Stack Overflow
See other posts from Stack Overflow
or by AndrewW
Published on 2010-05-28T12:48:12Z
Indexed on
2010/05/28
12:52 UTC
Read the original article
Hit count: 855
Hi,
In a C# WebBrowser control, I have generated a SELECT HtmlElement with a number of OPTION elements using w.RenderBeginTag(HtmlTextWriterTag.Select).
I need to get the value of the select when the user changes it, and so added an event handler in the WebBrowser DocumentCompleted event.
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
....
webBrowser1.Document.GetElementById("id_select_0").AttachEventHandler("onchange", new EventHandler(ddSelectedIndexChanged));
....
}
protected void ddSelectedIndexChanged(object sender, EventArgs e)
{
....
}
The event handler does get called, but the sender parameter is null and e is empty. Does anyone know how to overcome this problem?
Andrew
© Stack Overflow or respective owner