【发布时间】:2018-09-04 16:43:13
【问题描述】:
我已经为用户的多项选择设置了以下方法,并将其以 CSV 格式存储在数据库中。
<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
我的问题是,当添加/编辑活动执行时,如何填充复选框中的值。 提前致谢
【问题讨论】:
-
我想这就是你要找的东西:stackoverflow.com/questions/23301832/…
-
我需要对用户首先标记的存储值进行标记检查,并以逗号分隔值格式(如“星期一、星期二、星期四”)存储在数据库中。在更新调用时,这些值会在屏幕上检查
标签: c# asp.net checkbox checkboxlist