zoukankan
html css js c++ java
Coustom web control 自定义控件
简单控件 事件
EventManager
using
System;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.ComponentModel;
namespace
MyControls
{
/**/
///
<summary>
///
Summary description for MyEventManager.
///
</summary>
[DefaultEvent(
"
NextClick
"
),DefaultProperty(
"
text
"
)]
public
class
MyEventManager : System.Web.UI.WebControls.WebControl,IPostBackEventHandler
{
public
event
EventHandler NextClick;
public
event
EventHandler PreClick;
[Bindable(
true
),Category(
"
Behavior
"
),DefaultValue(
""
),Description(
"
text
"
)]
public
string
text
{
get
{
return
( (
string
)ViewState[
"
text
"
]
==
null
)
?
string
.Empty:(
string
)ViewState[
"
text
"
] ;
}
set
{
ViewState[
"
text
"
]
=
value;
}
}
protected
virtual
void
OnNextClick(EventArgs e)
{
if
(NextClick
!=
null
)
{
NextClick(
this
,EventArgs.Empty);
}
}
protected
virtual
void
OnPreClick(EventArgs e)
{
if
(PreClick
!=
null
)
{
PreClick(
this
,EventArgs.Empty);
}
}
void
IPostBackEventHandler.RaisePostBackEvent(
string
EventArguments)
{
if
( EventArguments
==
"
Pre
"
)
{
OnPreClick(EventArgs.Empty);
Page.Trace.Warn(
"
Pre Button Click
"
);
}
else
{
OnNextClick(EventArgs.Empty);
Page.Trace.Warn(
"
Next Button Click
"
);
}
}
[Bindable(
true
),
Category(
"
Appearance
"
),
DefaultValue(
""
)]
protected
override
void
Render(HtmlTextWriter output)
{
//
output.Write(Text);
this
.Attributes.AddAttributes(output);
output.AddAttribute(HtmlTextWriterAttribute.Onclick,Page.GetPostBackEventReference(
this
,
"
Pre
"
));
output.AddAttribute(
"
language
"
,
"
javascript
"
);
output.RenderBeginTag(HtmlTextWriterTag.Button);
output.Write(
"
Pre
"
);
output.RenderEndTag();
output.AddAttribute(HtmlTextWriterAttribute.Onclick,Page.GetPostBackEventReference(
this
,
"
Next
"
));
output.AddAttribute(
"
language
"
,
"
javascript
"
);
output.RenderBeginTag(HtmlTextWriterTag.Button);
output.Write(
"
Next
"
);
output.RenderEndTag();
base
.Render(output);
}
}
}
查看全文
相关阅读:
[LeetCode] 1081. Smallest Subsequence of Distinct Characters 不同字符的最小子序列
[LeetCode] 1080. Insufficient Nodes in Root to Leaf Paths 根到叶路径上的不足节点
[LeetCode] 1079. Letter Tile Possibilities 活字印刷
[LeetCode] 1078. Occurrences After Bigram 双元语法分词
[LeetCode] 1074. Number of Submatrices That Sum to Target 元素和为目标值的子矩阵数量
[LeetCode] 1073. Adding Two Negabinary Numbers 负二进制数相加
[LeetCode] 1072. Flip Columns For Maximum Number of Equal Rows 按列翻转得到最大值等行数
[LeetCode] 1071. Greatest Common Divisor of Strings 字符串的最大公因子
[LeetCode] 1054. Distant Barcodes 距离相等的条形码
[LeetCode] 1053. Previous Permutation With One Swap 交换一次的先前全排列
原文地址:https://www.cnblogs.com/yizhinantian/p/558878.html
最新文章
免费好用的Diff和Merge工具大总结
linux中单引号‘ ,双引号“, 反引号 ` `, $, $(), ${}与变量
Shell 反引号、$() 和 ${} 的区别
map比起unordered_map的优势主要有(hashmap就是unordered_map)
理清gcc、libc、libstdc++的关系(libstdc++是gcc搞的,libc++是llvm搞的,他们都是C++标准库的实现)
使用hbase,hive,hbase与建立宽表和ES 的分布式架构,实时监听到 db 的字段变更,再将变更的内容实时同步到 ES 和宽表设计天生支持海量数据查询
C#中的Dispatcher
VS自带的xsd.exe工具,根据XML自动生成XSD
IIS日志分析器Log Parser Studio
什么是 Istio&GetIstio?
热门文章
VS2008项目转换成VS2019项目
JavaScript ,竟然还不知道这些技巧?
Linux&Unix
Mocks Aren't Stubs
应对变化的要诀是隔离
Homebrew
[LeetCode] 1088. Confusing Number II 易混淆数之二
[LeetCode] 1057. Campus Bikes 校园自行车
[LeetCode] 1056. Confusing Number 混淆的数字
[LeetCode] 1055. Shortest Way to Form String 形成字符串的最短方法
Copyright © 2011-2022 走看看