Hi,
I am making an autofill-program, and have some issues with selecting radiobuttons. I use Visual C# 2010 express edition.
Normally I just use getelementsbyid, setattribute and invokemember, but I don't see how I can select a radiobutton without id. Maybe I need to edit the html to make a radiobutton checked, and then just use invokemember to submit?
TypeScript
type="radio" name="x1" value="ve"> Vero
type="radio" name="x1" value="ee"> Eee
type="radio" name="x1" value="wa"> Walla
type="radio" name="x1" value="qu"> QuackAs you see, there is no default select.
I'am new to C# so I don't know what it can do, but it would be cool to learn how to edit websites html through C#. I really just need to add "checked" to one of them radiobutton. I have a lot of experience with html, so if I can find out how I can use C# to find and insert code; it would be great.
Best Regards
Kenneth

Amit ChoudharyRank #145 · 15.8K reputationPosted Apr 27, 2011, 9:09 AM EDT
The html files can be treated as XML files so you can use XML classes to manipulate the HTML attributes. so as per your requirement you can insert the checked attribute into the radio button.
Kenneth5 reputationPosted Apr 27, 2011, 9:34 AM EDT
Amit ChoudharyRank #145 · 15.8K reputationPosted Apr 27, 2011, 9:46 AM EDT
Check out the HTML Agility Pack to do all sorts of HTML manipulation
It gives you an interface somewhat similar to the
XmlDocumentXML handling interface:HtmlDocument doc = new HtmlDocument(); doc.Load("file.htm"); HtmlNode bodyNode = doc.DocumentNode.SelectSingleNode("/html/body"); if(bodyNode != null) { // do something } or you can refer to a good blog on HTML editing in c# hereKenneth5 reputationPosted Apr 27, 2011, 12:24 PM EDT