zoukankan
html css js c++ java
奇怪的CheckBoxList...
当CheckBoxList的Enabled属性设置为false时,页面回传后其选择状态会丢失,不是否为Bug? 测试页面如下:
ASPX:
aspx
<%
@ Page language
=
"
c#
"
Codebehind
=
"
WebForm_disabledctrlsState.aspx.cs
"
AutoEventWireup
=
"
false
"
Inherits
=
"
WebApplicationTest.WebForm_disabledctrlsState
"
%>
<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
>
<
HTML
>
<
HEAD
>
<
title
>
WebForm_disabledctrlsState
</
title
>
<
meta
content
="Microsoft Visual Studio .NET 7.1"
name
="GENERATOR"
>
<
meta
content
="C#"
name
="CODE_LANGUAGE"
>
<
meta
content
="JavaScript"
name
="vs_defaultClientScript"
>
<
meta
content
="http://schemas.microsoft.com/intellisense/ie5"
name
="vs_targetSchema"
>
</
HEAD
>
<
body
MS_POSITIONING
="GridLayout"
>
<
form
id
="Form1"
method
="post"
runat
="server"
>
<
TABLE
id
="Table1"
style
="Z-INDEX: 101; LEFT: 8px; WIDTH: 400px; POSITION: absolute; TOP: 32px; HEIGHT: 114px"
cellSpacing
="0"
cellPadding
="0"
width
="400"
border
="0"
>
<
TR
>
<
TD
style
="WIDTH: 181px; HEIGHT: 18px"
><
FONT
face
="宋体"
>
CheckBoxList:
</
FONT
></
TD
>
<
TD
style
="WIDTH: 181px; HEIGHT: 18px"
><
FONT
face
="宋体"
></
FONT
></
TD
>
<
TD
style
="WIDTH: 70px; HEIGHT: 18px"
></
TD
>
<
TD
style
="WIDTH: 70px; HEIGHT: 18px"
>
RadioButtonList:
</
TD
>
<
TD
style
="HEIGHT: 18px"
></
TD
>
</
TR
>
<
TR
>
<
TD
style
="WIDTH: 181px"
bgColor
="blue"
height
="1"
></
TD
>
<
TD
style
="WIDTH: 181px"
bgColor
="blue"
height
="1"
></
TD
>
<
TD
style
="WIDTH: 70px"
bgColor
="blue"
height
="1"
></
TD
>
<
TD
style
="WIDTH: 70px"
bgColor
="blue"
height
="1"
></
TD
>
<
TD
bgColor
="blue"
height
="1"
></
TD
>
</
TR
>
<
TR
>
<
TD
style
="WIDTH: 181px"
>
CheckBoxList1
</
TD
>
<
TD
style
="WIDTH: 181px"
>
<
asp:CheckBoxList
id
="CheckBoxList1"
runat
="server"
RepeatDirection
="Horizontal"
Width
="168px"
>
<
asp:ListItem
Value
="1"
Selected
="True"
>
1
</
asp:ListItem
>
<
asp:ListItem
Value
="2"
Selected
="True"
>
2
</
asp:ListItem
>
<
asp:ListItem
Value
="3"
>
3
</
asp:ListItem
>
</
asp:CheckBoxList
></
TD
>
<
TD
style
="WIDTH: 70px"
></
TD
>
<
TD
style
="WIDTH: 70px"
><
FONT
face
="宋体"
>
RadioButtonList1
</
FONT
></
TD
>
<
TD
>
<
asp:RadioButtonList
id
="RadioButtonList1"
runat
="server"
RepeatDirection
="Horizontal"
Width
="168px"
>
<
asp:ListItem
Value
="1"
>
1
</
asp:ListItem
>
<
asp:ListItem
Value
="2"
Selected
="True"
>
2
</
asp:ListItem
>
<
asp:ListItem
Value
="3"
>
3
</
asp:ListItem
>
</
asp:RadioButtonList
></
TD
>
</
TR
>
<
TR
>
<
TD
style
="WIDTH: 181px"
>
CheckBoxList2
</
TD
>
<
TD
style
="WIDTH: 181px"
>
<
asp:CheckBoxList
id
="CheckBoxList2"
runat
="server"
RepeatDirection
="Horizontal"
Width
="168px"
Enabled
="False"
>
<
asp:ListItem
Value
="1"
Selected
="True"
>
1
</
asp:ListItem
>
<
asp:ListItem
Value
="2"
Selected
="True"
>
2
</
asp:ListItem
>
<
asp:ListItem
Value
="3"
>
3
</
asp:ListItem
>
</
asp:CheckBoxList
></
TD
>
<
TD
style
="WIDTH: 70px"
></
TD
>
<
TD
style
="WIDTH: 70px"
><
FONT
face
="宋体"
>
RadioButtonList2
</
FONT
></
TD
>
<
TD
>
<
asp:RadioButtonList
id
="RadioButtonList2"
runat
="server"
RepeatDirection
="Horizontal"
Width
="168px"
Enabled
="False"
>
<
asp:ListItem
Value
="1"
>
1
</
asp:ListItem
>
<
asp:ListItem
Value
="2"
Selected
="True"
>
2
</
asp:ListItem
>
<
asp:ListItem
Value
="3"
>
3
</
asp:ListItem
>
</
asp:RadioButtonList
></
TD
>
</
TR
>
<
TR
>
<
TD
style
="WIDTH: 181px"
bgColor
="blue"
height
="1"
></
TD
>
<
TD
style
="WIDTH: 181px"
bgColor
="blue"
height
="1"
></
TD
>
<
TD
style
="WIDTH: 70px"
bgColor
="blue"
height
="1"
></
TD
>
<
TD
style
="WIDTH: 70px"
bgColor
="blue"
height
="1"
></
TD
>
<
TD
bgColor
="blue"
height
="1"
></
TD
>
</
TR
>
<
TR
>
<
TR
>
<
TD
style
="WIDTH: 181px"
></
TD
>
<
TD
style
="WIDTH: 181px"
>
<
asp:Button
id
="Button1"
runat
="server"
Text
="SelectItems"
></
asp:Button
></
TD
>
<
TD
style
="WIDTH: 70px"
>
<
asp:Button
id
="Button2"
runat
="server"
Text
="Refresh"
></
asp:Button
></
TD
>
<
TD
style
="WIDTH: 70px"
></
TD
>
<
TD
></
TD
>
</
TR
>
</
TABLE
>
<
asp:Label
id
="Label1"
style
="Z-INDEX: 102; LEFT: 8px; POSITION: absolute; TOP: 8px"
runat
="server"
Width
="720px"
ForeColor
="Red"
Font-Bold
="True"
>
注意:点击Refresh按钮(回传)后CheckBoxList2的选择状态丢失了!而RadioButtonList2则不会。
</
asp:Label
></
form
>
</
body
>
</
HTML
>
ASPX.CS:
Codebehind
1
using
System;
2
using
System.Collections;
3
using
System.ComponentModel;
4
using
System.Data;
5
using
System.Drawing;
6
using
System.Web;
7
using
System.Web.SessionState;
8
using
System.Web.UI;
9
using
System.Web.UI.WebControls;
10
using
System.Web.UI.HtmlControls;
11
12
namespace
WebApplicationTest
13
{
14
/**/
///
<summary>
15
///
WebForm_disabledctrlsState 的摘要说明。
16
///
</summary>
17
public
class
WebForm_disabledctrlsState : System.Web.UI.Page
18
{
19
protected
System.Web.UI.WebControls.CheckBoxList CheckBoxList1;
20
protected
System.Web.UI.WebControls.CheckBoxList CheckBoxList2;
21
protected
System.Web.UI.WebControls.RadioButtonList RadioButtonList1;
22
protected
System.Web.UI.WebControls.RadioButtonList RadioButtonList2;
23
protected
System.Web.UI.WebControls.Label Label1;
24
protected
System.Web.UI.WebControls.Button Button1;
25
protected
System.Web.UI.WebControls.Button Button2;
26
27
private
void
Page_Load(
object
sender, System.EventArgs e)
28
{
29
//
在此处放置用户代码以初始化页面
30
}
31
32
Web 窗体设计器生成的代码
#region
Web 窗体设计器生成的代码
33
override
protected
void
OnInit(EventArgs e)
34
{
35
//
36
//
CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
37
//
38
InitializeComponent();
39
base
.OnInit(e);
40
}
41
42
/**/
///
<summary>
43
///
设计器支持所需的方法 - 不要使用代码编辑器修改
44
///
此方法的内容。
45
///
</summary>
46
private
void
InitializeComponent()
47
{
48
this
.Button2.Click
+=
new
System.EventHandler(
this
.Button2_Click);
49
this
.Button1.Click
+=
new
System.EventHandler(
this
.Button1_Click);
50
this
.Load
+=
new
System.EventHandler(
this
.Page_Load);
51
52
}
53
#endregion
54
55
private
void
Button2_Click(
object
sender, System.EventArgs e)
56
{
57
//
Do Nothing ..
58
}
59
60
private
void
Button1_Click(
object
sender, System.EventArgs e)
61
{
62
this
.CheckBoxList2.Items[
1
].Selected
=
true
;
63
this
.CheckBoxList2.Items[
2
].Selected
=
true
;
64
}
65
}
66
}
67
注:我的操作系统是windowsXP prof ;开发环境是vs 2003 ;
查看全文
相关阅读:
Elasticsearch--预匹配器
Elasticsearch--建议器
Elasticsearch--聚合
Elasticsearch--扩展索引结构
Elasticsearch--更好的搜索_加权得分,脚本,同义词
Elasticsearch--搜索
信息论基础概念
一个人的思想决定一个人的行为,一个人的行为决定一个人的习惯,一个人的习惯决定一个人的性格,一个人的性格决定一个人的命运,一个人的命运决定一个人的一生。
宝塔的外网地址忘记 解决办法
一定要先看文档 hyperf
原文地址:https://www.cnblogs.com/BlueFly/p/359754.html
最新文章
html部分常用标签 <img /> 和 <a > </a> 和 <table> </table> 和 <hr/> 和<br/> 以及 和&emsp
【纯手打】手动将war包部署到Tomcat服务器上
Java小知识--System.arraycopy( )的用法
mysql小知识--增删改查
Java学习总结--第一阶段--fundamental
Java小知识--IO流中--try-catch-resource的一个小发现
kali2020.01修改root终端颜色
Tomcat AJP 文件包含漏洞复现(CVE-2020-1938)
Open SSH CVE-2020-15778
常见未授权访问漏洞总结合集
热门文章
kali docker简单使用-vulhub搭建fastjson漏洞环境
kali 2020安装docker
fastjson远程代码执行漏洞复现
kali linux没有ip解决办法
kali 开启SSH服务
CVE-2019-2618任意文件上传漏洞复现
手把手教你用Eclipse+TestNG搭建接口自动化测试框架
Elasticsearch--集群&吞吐量
Elasticsearch--集群&时光之门和恢复控制
Elasticsearch--地理搜索
Copyright © 2011-2022 走看看