zoukankan
html css js c++ java
ASP.NET 2.0中隐藏listbox的某一项
在asp.net 2.0中,可以隐藏listbox中的某一项,比如
ListItem item = new ListItem(text, value, enabled);
当然,也可以用
item.Enabled = false;
虽然在页面中隐藏了,但依然可以用代码来访问隐藏的选项的,下面是一个例子
<%
@ Page Language
=
"
C#
"
%>
<
script
runat
="server"
>
protected
void
Page_Load(object sender, EventArgs e)
{
if
(
!
Page.IsPostBack)
{
ListItem[] items
=
new
ListItem[]
{
new
ListItem(
"
Item 1
"
,
"
Value 1
"
),
new
ListItem(
"
Item 2
"
,
"
Value 2
"
,
false
),
new
ListItem(
"
Item 3
"
,
"
Value 3
"
),
new
ListItem(
"
Item 4
"
,
"
Value 4
"
)
}
;
ListBox1.Items.AddRange(items);
}
}
protected
void
Button1_Click(object sender, EventArgs e)
{
foreach (ListItem item
in
ListBox1.Items)
{
Response.Write(item.Text
+
"
enabled=
"
+
item.Enabled
+
"
<br>
"
);
}
}
</
script
>
<
html
xmlns
="http://www.w3.org/1999/xhtml"
>
<
head
runat
="server"
>
<
title
>
Untitled Page
</
title
>
</
head
>
<
body
>
<
form
id
="form1"
runat
="server"
>
<
div
>
<
asp:ListBox
ID
="ListBox1"
runat
="server"
/>
<
asp:Button
ID
="Button1"
runat
="server"
Text
="Button"
OnClick
="Button1_Click"
/></
div
>
</
form
>
</
body
>
</
html
>
查看全文
相关阅读:
分布式事务解决方案1--使用Atomikos分布式事务(事务强一致方案)
SringBoot集成Sharding-Jdbc 实践
Sharding-Jdbc简介
Mycat+haproxy中使用keepalived保障haproxy的高可用
Angular CLI
背压(Backpressure)机制
Function.identity()
解决Error: ENOENT: no such file or directory, scandir 安装node-sass报错
Reactor flatMap
Reactor map
原文地址:https://www.cnblogs.com/ghd258/p/262995.html
最新文章
lldb 调试 linux下 .net Core 非托管命令:
Linux下调试.Net core:lldb的安装
了解linux 内核代码dump_stack()执行流程
dotnet core 高CPU定位 dotnet-dump篇
K8S服务发现与负载均衡原理
K8S网络模型原理
K8s控制器管理原理与实践
Spring Cloud Alibaba介绍
K8s调度原理和Pod生命周期
K8s常用命令和扩缩容
热门文章
K8S基础集群搭建
服务编排K8S整体架构和功能介绍
服务编排 Mesos+Marathon 介绍
Docker常用命令的使用
容器技术介绍
分布式事务解决方案4--消息队列MQ(事务最终一致方案)
Windown10下Rocket MQ 安装
分布式事务解决方案3--本地消息表(事务最终一致方案)
分布式事务解决方案2--TCC事务补偿实践(事务强一致方案)
MyCat和Sharding-JDBC的分布式事务
Copyright © 2011-2022 走看看