Heim  >  Artikel  >  Web-Frontend  >  CheckBoxList多选样式jquery、C#获取选择项示例介绍

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

PHP中文网
PHP中文网Original
2017-03-31 16:17:181541Durchsuche

使用jqueryC#获取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(&#39;,&#39;);

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


Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn