c# - CheckBoxList not working properly -
i have code. gives fales
item.selected
<asp:literal id="literalemployeelist" runat="server" /> <asp:linkbutton id="linkbuttonrecipients" runat="server">add/remove recipients</asp:linkbutton> <ajaxtoolkit:modalpopupextender id="modalpopupextenderto" runat="server" targetcontrolid="linkbuttonrecipients" dropshadow="true" popupcontrolid="panelemployeelist" okcontrolid="buttonok" enableviewstate="true"> </ajaxtoolkit:modalpopupextender> <asp:panel id="panelemployeelist" runat="server" width="200" height="100" scrollbars="vertical"> <div id="divpanelbody"> <div id="divlist"> <asp:checkboxlist id="checkboxlistemployee" runat="server" enableviewstate="true" onselectedindexchanged="checkboxlistemployee_selectedindexchanged"> </asp:checkboxlist> </div> <div id="divcontrols"> <asp:button id="buttonok" runat="server" text="ok" /> </div> </div> </asp:panel>
checkboxlist
bound data source , working.
protected void checkboxlistemployee_selectedindexchanged(object sender, eventargs e) { literalemployeelist.text = string.empty; foreach (listitem item in checkboxlistemployee.items) { if (item.selected) { literalemployeelist.text += item.text + ", "; } } }
any idea whats wrong? thanx..
try this...
for (int = 0; < interestedin.items.count; i++) { if (interestedin.items[i].selected) { values += interestedin.items[i].value + ","; } } values = values.trimend(',');
Comments
Post a Comment