当前位置:Gxlcms > JavaScript > CheckBoxList多选样式jquery、C#获取选择项示例介绍

CheckBoxList多选样式jquery、C#获取选择项示例介绍

时间:2021-07-01 10:21:17 帮助过:8人阅读

使用jquery、C#获取CheckBoxList选择项,实现如下,感兴趣的朋友可以参考下

代码如下:

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

代码如下:

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

代码如下:

<asp:CheckBoxList ID="ddlplatform" 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(',');

以上就是CheckBoxList多选样式jquery、C#获取选择项示例介绍的内容,更多相关内容请关注PHP中文网(www.gxlcms.com)!

人气教程排行