c# - CheckBoxList Problem -


i have checkboxlist in c# databound database. display icon on right side after text each of checkboxlist items. each icon needs different though. help!

you this

<asp:checkboxlist id="checkboxlist1" runat="server" datasourceid="datasourceid" datatextfield="datatextfield" datavaluefield="datatextvalue" ondatabound="checkboxlist1_databound"> </asp:checkboxlist>  protected void checkboxlist1_databound(object sender, eventargs e) {     var checkbox = sender checkboxlist;     if(checkbox != null)     {         foreach (listitem listitem in checkbox.items)         {             listitem.text = string.format("{0}<img src='{1}' />", listitem.text, getimagefor(listitem.text));         }     }  }  private string getimagefor(string text) {     // return image url check box based on text.      if(text.equals("banana")) return "banana.gif";     ...     ... } 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -