Can't post back JavaScript changes to ASP.NET ListBox option properties/attributes -
i'm trying use javascript change properties or attributes of asp.net listbox's options, changes server sees on postback (asp:button click) selected state of options. i'm trying convey ss code should ignore selected options, , hoping use simple noting hidden state, setting option's disabled property, or adding attribute. control, , failed js lines:
<asp:listbox id="lstfacilities" runat="server" selectionmode="multiple" height="200" />
//lbxfacs returned document.getelementbyid lbxfacs.options[f].style.display = 'none'; lbxfacs.options[f].disabled = true; lbxfacs.options[f].setattribute('disabled', 'disabled');
i hide them view after selecting filter control, , works ui standpoint, server seems have no way of knowing they're hidden. try disable them, enabled property true. adding attributes useless too; attributes collection empty. server-side snippet:
bool allselected = lstfacilities.items[0].selected; //"all facilities", want visible options foreach (listitem option in lstfacilities.items) { var optatts = option.attributes; //always empty if ((allselected || option.selected) && option.value != "all" && option.enabled) selectedfacsids += "," + facid; //always gets here when "all" selected , options invisible }
i can't changes options' text or values come in ss. i've tried jquery equivalents. there way rectify this, or have invoke proven backup plan of having js set value of hidden input server read options valid? thanks...
Comments
Post a Comment