I have set up the following method for multiple selection from user and store it in CSV format in Database.
<div class="col-md-10" style="padding-top: 7px;">
<asp:CheckBoxList ID="CheckBoxList1" runat="server" DataTextField="language"
DataValueField="language" AutoPostBack="True" RepeatLayout="OrderedList" Width="432px">
<asp:ListItem Value="Saturday">Saturday</asp:ListItem>
<asp:ListItem Value="Sunday">Sunday</asp:ListItem>
<asp:ListItem Value="Monday">Monday</asp:ListItem>
<asp:ListItem Value="Tuesday">Tuesday</asp:ListItem>
<asp:ListItem Value="Wednesday">Wednesday</asp:ListItem>
<asp:ListItem Value="Thursday">Thursday</asp:ListItem>
</asp:CheckBoxList>
</div>
private string CheckBoxListDataToCSV() {
string selectedItems = String.Join(",",
CheckBoxList1.Items.OfType<ListItem>().Where(r => r.Selected)
.Select(r => r.Text));
return selectedItems;
string str = CheckBoxListDataToCSV(); //This method to Add in datarow
My question is that how to populate back the values in their check boxes when Add/Edit activity perform. Thanking in Advance
Aucun commentaire:
Enregistrer un commentaire