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

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -