This project is read-only.

CUITe_HTMLList.Items splitting option item on spaces

May 19, 2014 at 5:23 PM
Edited May 19, 2014 at 7:17 PM
The following is the HTML for the box I am testing:
    <select id="From" multiple="multiple">
        <option value="column-1-level">First Option</option>
        <option value="column-2-number">Second Option</option>
        <option value="column-3-in">Third Option</option>
        <option value="column-4-out">Fourth Option</option>
        <option value="column-5-select">Fifth Option</option>
        <option value="column-6">Sixth Option</option>
        <option value="column-7">Seventh Option</option>
        <option value="column-8">Eighth Option</option>
        <option value="column-9">One more Option</option>
        <option value="column-10">Tenth Option</option>
        <option value="column-11">Eleventh Option</option>
        <option value="column-12">Twelfth Option</option>
However when I do a pg.lstFromBox.Items, I get the following back:
  • First
  • OptionSecond
  • OptionThird
  • OptionFourth
  • OptionFifth
  • OptionSixth
  • OptionSeventh
  • OptionEighth
  • OptionOne
  • more
  • OptionTenth
  • OptionEleventh
  • OptionTwelfth
  • Option
Any clues as to what I'm doing wrong here?

Did a few more tests. Just to be sure it was nothing in the whitespace, I selected the first item and checked the Selected Items property & it correctly showed 1 selected item & its description. Also selected 3 items & it correctly showed 3 items & their expected descriptions.
May 19, 2014 at 10:43 PM
Edited May 22, 2014 at 8:25 PM
Looking a tthe code some more it looks like the latest version of the get for Items is where the bug exists.

Previous version was
return  GetPropertyOfChildren<string>(HtmlControl.PropertyNames.InnerText)  ;
Current version is
//trying to call InnerText of children will cause errors if child items are disabled    
return InnerText.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
Looks like it was updated to fix a bug with disabled Items. Not sure what the workaround is yet.

Just as an update, in case anyone else runs into this issue and needs a quick fix.

I ended up rolling back the changes in the above file to the version from commit #23679.
Also added back GetPropertyOfChildren to HtmlControl.cs to work with that version of HtmlList and I have the CUITe_HtmlList working as it was before.