Finally, I will find out with one of my friends. This small feature will make everything very simple.
Thanks to Farrukh Momin and his time.
public void SetComboItem(string id, string value) { HtmlElement ee = this.webBrowser1.Document.GetElementById(id); foreach (HtmlElement item in ee.Children) { if (item.OuterHtml.ToLower().IndexOf(value.ToLower()) >= 0) { item.SetAttribute("selected", "selected"); item.InvokeMember("onChange"); } else { item.SetAttribute("selected", ""); } } ee = this.webBrowser1.Document.GetElementById(id + "-input"); ee.InnerText = value; }
Call function
this.SetComboItem("MySite.condition_s", "First");
source share