Beispiel #1
0
        public List <string> GetSelectOptions(string Name)
        {
            List <string> Fields = new List <string>();

            foreach (Element El in SelectElements)
            {
                if (El.HasName && El.Name.Equals(Name))
                {
                    HtmlNodeCollection OptionColl = El.SelectNodes(".//option");
                    if (OptionColl != null)
                    {
                        for (int i = 0; i < OptionColl.Count; i++)
                        {
                            try
                            {
                                Fields.Add((new Element(OptionColl[i], i)).Attributes.Get("value").Value);
                            }
                            catch
                            {
                                //Exception thrown probably because there was not attribute named 'value'
                            }
                        }
                    }
                }
            }
            return(Fields);
        }