如何从复选框列表中隐藏一个或多个复选框 [英] How to hide the one or more checkboxes from checkboxlist

查看:161
本文介绍了如何从复选框列表中隐藏一个或多个复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从复选框列表中隐藏一个或多个复选框

How to hide the one or more checkboxes from checkboxlist

推荐答案

首先将复选框列表添加到aspx页面.
喜欢,

First add the checkboxlist to the aspx page.
like,

<asp:checkboxlist id="CheckBoxList1" runat="server">

 <asp:ListItem Value="1" Enabled="True">ITEM1
 <asp:ListItem Value="2" Enabled="True">ITEM2
 <asp:ListItem Value="3" Enabled="True">ITEM3
 <asp:ListItem Value="4" Enabled="True">ITEM4
 <asp:ListItem Value="5" Enabled="True">ITEM5
 <asp:ListItem Value="6" Enabled="True">ITEM6br mode="hold" />  



之后,将以下方法添加到.cs/.vb file

如果要隐藏特定列表项,可以按照以下方式进行操作

在页面加载事件中



after that add the following method to the .cs/.vb file

if you want to hide the specifi listitems you can do like following way

in pageload event

CheckBoxList1.Items(2).Enabled = False
 CheckBoxList1.Items(4).Enabled = False


我们还可以隐藏列表项.


We can also hide the list items.

Dim item As ListItem
       For Each item In CheckBoxList1.Items
           If item.Value = 4 Then
           item.Attributes.Add("style", "display:none")


这篇关于如何从复选框列表中隐藏一个或多个复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆