zoukankan
html css js c++ java
asp.net控件开发基础(3)
类型可供选择的按钮自定义控件
using
System;
using
System.Collections.Generic;
using
System.Text;
using
System.Web.UI;
using
System.ComponentModel;
namespace
ComponentControl
{
public
class
Ctrl5:Control,IPostBackEventHandler
{
private
static
readonly
object
obj
=
new
object
();
[Description(
"
按钮显示的类型
"
)]
public
BtnType ButtonType
{
get
{
return
ViewState[
"
ButtonType
"
]
==
null
?
BtnType.Button : (BtnType)ViewState[
"
ButtonType
"
]; }
set
{ ViewState[
"
ButtonType
"
]
=
value; }
}
//
事件
public
virtual
event
EventHandler Click
{
add
{
Events.AddHandler(obj, value);
}
remove
{
Events.RemoveHandler(obj, value);
}
}
//
控件重写
protected
override
void
Render(HtmlTextWriter writer)
{
if
(ButtonType
==
BtnType.Button)
writer.Write(
"
<input type=submit name=
"
+
this
.UniqueID
+
"
value=Button />
"
);
else
if
(ButtonType
==
BtnType.LinkButton)
writer.Write(
"
<a href=
"
+
Page.GetPostBackClientHyperlink(
this
,
""
)
+
"
>Button</a>
"
);
}
IPostBackEventHandler 成员
#region
IPostBackEventHandler 成员
public
void
RaisePostBackEvent(
string
eventArgument)
{
EventHandler child
=
(EventHandler)Events[obj];
if
(child
!=
null
)
child(
this
, EventArgs.Empty);
}
#endregion
}
//
按钮类型枚举
public
enum
BtnType
{
Button,
LinkButton
}
}
,
这个送给你!
查看全文
相关阅读:
单元测试、集成测试、系统测试
函数
python中的math函数
字符串和数据类型转换
range()函数
input()函数
Linux如何通过命令查看日志文件的某几行(中间极几行或最后几行)
【转】接口测试面试题
【转】用Fiddler做抓包分析详解
为什么要使用fiddler抓包?抓包用来干什么?
原文地址:https://www.cnblogs.com/di305449473/p/1245800.html
最新文章
git相关网址
"Access restriction: The type BASE64Encoder is not accessible due to restrict"问题解决
java中BigDecimal在金融行业中的使用
通道加解密、发送问题感想
Git学习总结(一)
mysql数据库使用sql命令窗口查询的数据,改成sql语句导入到mysql数据库中
二维码生成器
百付宝支付通道加解密和加签验签总结
从感知机到支持向量机—学习笔记
gradients的一些注意点
热门文章
模型搭建练习2_实现nn模块、optim、two_layer、dynamic_net
学习记录
模型搭建练习1_用numpy和tensor、variable实现前后向传播、实现激活函数
前沿技术讲习班学习笔记2-车老师
机器学习优化问题-经验风险、期望风险、结构风险
前沿技术讲习班学习笔记1-邱锡鹏老师
调参tips
weight initilzation
手机连接fiddler无法上网
Cookie中的httponly的属性和作用
Copyright © 2011-2022 走看看