CheckBoxList 多选 样式 jquery获取选择项 C#获取选择项

[css][/css] view plaincopy

  1. .checkboxlist label
  2.        {
  3.            margin-right: 20px;
  4.        }

 

[javascript][/javascript] view plaincopy

  1. var label;
  2.            $(“#ddlplatform input:checkbox:checked”).each(function () {
  3.                label += $(this).next().html();
  4.            });

 

[html][/html] view plaincopy

  1. <asp:CheckBoxList ID=”ddlplatform” runat=”server” RepeatDirection=”Horizontal” RepeatLayout=”Flow”
  2.                        CssClass=”checkboxlist”>
  3.                        <asp:ListItem Value=”APP”>APP</asp:ListItem>
  4.                        <asp:ListItem Value=”移动触屏”>移动触屏</asp:ListItem>
  5.                        <asp:ListItem Value=”PC”>PC</asp:ListItem>
  6.                        <asp:ListItem Value=”微信”>微信</asp:ListItem>
  7.                        <asp:ListItem Value=”微博”>微博</asp:ListItem>
  8.                    </asp:CheckBoxList>

 

[csharp][/csharp] view plaincopy

  1. //使用平台
  2.            string Platfrom = string.Empty;
  3.            foreach (ListItem li in this.ddlplatform.Items)
  4.            {
  5.                if (li.Selected)
  6.                {
  7.                    Platfrom += li.Text + “,”;
  8.                }
  9.            }
  10.            Platfrom = Platfrom.TrimEnd(‘,’);

标签