7

I am trying to select item from select list box using this method:

 var elements = webBrowser1.Document.GetElementsByTagName("select"); foreach (HtmlElement element in elements) { if (element.GetAttribute("id")=="pagesize") { element.GetElementsByTagName("option")[2].SetAttribute("selected", "selected"); webBrowser1.Document.InvokeMember("click"); } } 

from this html code

<select name="pagesize" id="pagesize" onchange="changeFileListRequestSize();"> <option value="10">10 files per page</option> <option value="25" selected="selected">25 files per page</option> <option value="50">50 files per page</option> <option value="100">100 files per page</option> <option value="200">200 files per page</option> </select> 

item is actually changes but that's doesn't execute onchange="changeFileListRequestSize();" javascript event.

how to simulate select list item click or "change"

2 Answers 2

7
document.GetElementById("pageSize").InvokeMember("onchange") 
Sign up to request clarification or add additional context in comments.

1 Comment

what about document.GetElementById("pageSize").InvokeMember("onchange") ?
-1

excelent work with this

 if (elm.GetAttribute("className").Contains("iceSelOneMnu")) { HtmlDocument doc = webBrowser1.Document; elm.SetAttribute("value", "630676649"); elm.InvokeMember("onchange"); } 

1 Comment

Please add more context on how this will help the OP. stackoverflow.com/help/how-to-answer

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.