c**t 发帖数: 2744 | 1 I'm using System.Windows.Forms.WebBrowser in one WPF project. I'm able to
check all radio buttons with the following code:
foreach(HtmlElment e in wb.Document.GetElementsByTagName("input"))
{
if( e.GetAttribute("type").Equals("radio"))
{
e.SetAttribute("checked", "true");
}
}
but the code e.SetAttribute("checked", "false") does NOT work. How to toggle
the radiobutton in Code behind?
My current work around is to execScript( myCustomJS ), and uncheck radio
buttons via javascrip | c**t 发帖数: 2744 | 2 found solution:
if( e.OuterHtml.Contains("CHECKED"))
e.OuterHtml = e.OuterHtml.Replace("CHECKED", "");
which will uncheck the radio button
toggle
【在 c**t 的大作中提到】 : I'm using System.Windows.Forms.WebBrowser in one WPF project. I'm able to : check all radio buttons with the following code: : foreach(HtmlElment e in wb.Document.GetElementsByTagName("input")) : { : if( e.GetAttribute("type").Equals("radio")) : { : e.SetAttribute("checked", "true"); : } : } : but the code e.SetAttribute("checked", "false") does NOT work. How to toggle
| k*****G 发帖数: 697 | | M******k 发帖数: 27573 | 4 same thing goes for html checkbox too.
【在 c**t 的大作中提到】 : found solution: : if( e.OuterHtml.Contains("CHECKED")) : e.OuterHtml = e.OuterHtml.Replace("CHECKED", ""); : which will uncheck the radio button : : toggle
|
|