tags:

views:

216

answers:

0

Hi,

I hestitate to post this question as it's surely a pretty simple one, but it's the first time for me to use radio buttons with mshtml and I can't figure out why it's not working. Here's the code I'm using:

IHTMLElementCollection inputElements = (IHTMLElementCollection)doc.all.tags("input");
foreach (IHTMLElement el in inputElements)
{
    string elementHtml = el.outerHTML;
    string cardOnFileIdentifier= "id=rdCC2";

    //  select the "Credit card on file" option
    if (elementHtml.Contains(cardOnFileIdentifier))
    {
     HTMLInputElement rdoOnFile = (HTMLInputElement)el;
     rdoOnFile.@checked = true;
    }
    else
    {
     //  do nothing - we're not interested in this element
    }
}

I've also tried it with code to set the default selection to false using the same sort of code as above, though I'm guessing it's not necessary. I've taken that out to keep it as simple as poss above. I've run it thru the debugger and the code is definitely executed. I'm "pretty damned sure" that it's the right element that's being targeted.

The bottom line is, it'd be good to know if the above seems okay.

Hey, your help is much appreciated, as usual.

Gregg