I am trying to create a custom attribute for each list item in an HTML HTML control file.
The HTML result should look something like this:
<select> <option value="1" data-value="myValue1">item</option> <option value="2" data-value="myValue2">item</option> <option value="3" data-value="myValue3">item</option> </select>
I tried adding such attributes, but they do not appear:
<select id="selectList" class="multiselect" multiple="true" name="selectList[]" runat="server"></select>
ListItemCollection values = new ListItemCollection(); ListItem test = new ListItem("add"); test.Attributes.Add("data-value", "myValue"); values.Add(test); this.selectList.DataSource = values; this.selectList.DataBind();
Any thoughts on how this can be achieved? Thanks!
kirkyoder
source share