首页 > 语言 > JavaScript > 正文

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

2024-05-06 15:51:40
字体:
来源:转载
供稿:网友
使用jquery、C#获取CheckBoxList选择项,实现如下,感兴趣的朋友可以参考下

复制代码 代码如下:


.checkboxlist label
{
margin-right: 20px;
}


复制代码 代码如下:


var label;
$("#ddlplatform input:checkbox:checked").each(function () {
label += $(this).next().html();
});


复制代码 代码如下:


<asp:CheckBoxList runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow"
CssClass="checkboxlist">
<asp:ListItem Value="APP">APP</asp:ListItem>
<asp:ListItem Value="移动触屏">移动触屏</asp:ListItem>
<asp:ListItem Value="PC">PC</asp:ListItem>
<asp:ListItem Value="微信">微信</asp:ListItem>
<asp:ListItem Value="微博">微博</asp:ListItem>
</asp:CheckBoxList>


复制代码 代码如下:


//使用平台
string Platfrom = string.Empty;
foreach (ListItem li in this.ddlplatform.Items)
{
if (li.Selected)
{
Platfrom += li.Text + ",";
}
}
Platfrom = Platfrom.TrimEnd(',');

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选