Reputation: 4530
If a website has a dropDownList, is it possible to extract all the values along with their ID using c#?
Thanks
As in:
<select name='dropDownList' >
<option value='0'>Watever</option>
<option value="1">Watever</option>
<option value="2">Watever</option>
<option value="3">Watever</option>
<option value="4">Watever</option>
I want to extract all the "value" as well as their corresponsing text.
Upvotes: 0
Views: 356
Reputation: 22763
I have already scrapped many sites, but there is no hard and fast rule for it.
I always use my own logic and easiest way is the sub string.
I am not saying that there is no better way but hardly you will get any.
Hope it will help you
Upvotes: 1
Reputation: 3789
If you use a ASP.NET site and add the dropdown list as element you can easily get/set the properties. If it´s not your site and you use a client to get to the html code you have to parse it. For html the HtmlAgilityPack is the best solution but you can also try to use regex if the query isn´t to complex.
Upvotes: 1