I have a CheckBoxList control that contains dynamically generated checkbox items. This checkboxlist will contain usernames. I am using Gravatar control from AjaxControlToolkit to allow users to have their own profile pictures. What I want is that when a checkbox with username as a text is added to the CheckBoxList, a Gravatar control should also be added before or after the checkbox, showing the corresponding display picture of the user. An alternative way came to my mind is to have a custom user control with a checkbox and gravatar. But if any other lite and easy solution available then please suggest me. Following is the code:
<table class="style1">
<tr>
<td align="right" style="padding: 5px" width="25%">
Username/Email:</td>
<td style="padding: 5px">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" CssClass="newButton"
onclick="Button1_Click" Text="Search" />
</td>
</tr>
<tr>
<td align="right" style="padding: 5px" valign="top" width="25%">
Results:</td>
<td style="padding: 5px">
<asp:CheckBoxList ID="CheckBoxList1" runat="server"
onselectedindexchanged="CheckBoxList1_SelectedIndexChanged"
AutoPostBack="True">
</asp:CheckBoxList>
</td>
</tr>
<tr>
<td align="right" style="padding: 5px" width="25%" valign="top">
Selected People:</td>
<td style="padding: 5px">
<asp:ListBox ID="ListBox1" runat="server" Height="149px" Width="260px">
</asp:ListBox>
</td>
</tr>
</table>
As you can see it also has a listbox that contains the selected item from checkboxlist. If possible please suggest me the same for the listbox.