Home > Web Front-end > JS Tutorial > body text

CheckBoxList multi-selection style jquery, C# example introduction to obtaining selected items

PHP中文网
Release: 2017-03-31 16:17:18
Original
1580 people have browsed it

Use jquery and C# to obtain CheckBoxList selections. The implementation is as follows. Interested friends can refer to the

code as follows:

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

The code is as follows:

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

The code is as follows:

<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>
Copy after login

The code is as follows:

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

The above is the introduction of CheckBoxList multi-select style jquery and C# to get the selection examples. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template