c# - disabled options are enabled after postback chosen.js asp.net -


i trying apply multiselect feature asp.net listbox using chosen.js.

this listbox contains values this

all -----------(disabled through c#) msg(disabled through c#) ---------(disabled through c#) control panel windows shell -------(disabled through c#) omst(disabled through c#) ----------(disabled through c# li.attributes.add("disable","true"); edocket dashboard 

initially dropdown working fine.but after postback disable items getting enabled.

disabled items getting render class="disabled-result" after postback class becoming "active-result".

can me on issue.

some of attributes of select and/or option elements not persisted automatically on post-back. must maintain own values things such "class" , "disabled". may via viewstate, database stores or other methods of choosing. somthing this:

private sub page_init(sender object, e system.eventargs) handles me.init     if ispostback         restoreproperties(dropdowncontrol)     else         loaddatabaseitems(dropdowncontrol)     end  end sub 

where "loaddatabaseitems" handle initial loading of drop-down list, setting initial attributes of both select control , member option elements. store class , disabled properties needed.

and "restoreproperties" represents home-grown view-state store. routine loop through 'alread-existing' option elements set class, disabled , other properties.


Comments