Click here to Skip to main content
13,090,541 members (47,896 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I what buid a custom attribute of select box,this attribute has a property is "listItem",how can
to load data value to the property of listitem?
Posted 15-Jan-13 16:45pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Marcus Kramer 16-Jan-13 9:53am
My 5.
Abhinav S 16-Jan-13 11:39am
Thank you.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

<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 id="selectList" class="multiselect" multiple="true" name="selectList[]" runat="server">&lt;/select>

ListItemCollection values = new ListItemCollection();
ListItem test = new ListItem("add");
test.Attributes.Add("data-value", "myValue");
this.selectList.DataSource = values;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 15 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100