I am new to jQuery and attempting to use the dropdownchecklist control
I am populating the select element from an asp.NET sqldatasource. However, I would also like the list to have an option for “Select All” as the first option, so that in jquery I can use the “firstItemChecksAll” in junction with the first option in the list (that is appropriately named “Select All” because thats what will happen when its clicked).
Is adding this element in addition to databinding possible (without adding a row to my db called “Select All”)? How do I accomplish this? I dont see AppendDataBoundItems as an option in the select element (I assume because its an html and not an asp.net control).
Here is what my code looks like now (I havent put the jquery code in yet)…
<select id="testBuSelect" multiple="true" runat="server" DataSourceID="BusinessUnitDataSource"
DataTextField="BUSINESS_UNIT_NAME" DataValueField="BUSINESS_UNIT_CODE"></select>
<asp:SqlDataSource ID="BusinessUnitDataSource" runat="server"
SelectCommand = "SELECT BUSINESS_UNIT_CODE, BUSINESS_UNIT_NAME FROM BUSINESS_UNIT ORDER BY BUSINESS_UNIT_CODE">
Try using
AppendDataBoundItemssee – http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listcontrol.appenddatabounditems.aspx. Something like this: