組件開發(fā)中常用的屬性
系統(tǒng)
2045 0
DefaultEvent( "ClickNext" ):指定組件的默認事件
DefaultProperty( "NextText" ):指定組件的默認屬性
Bindable(true or false):指定屬性是否通常用于綁定
Category( "Appearance" ):指定其屬性或事件將顯示在可視化設計器中的類別
DefaultValue( typeof( Color ) , "" ):指定屬性的默認值
Description( "The background color"):指定屬性或事件的說明
TypeConverter(typeof( WebColorConverter )):指定用作此特性所綁定到的對象的轉換器的類型
Browsable(true or false):指定一個屬性或事件是否應顯示在“屬性”窗口中
DesignerSerializationVisibility( DesignerSerializationVisibility.Hidden ):指定在設計時序列化組件上的屬性時所使用的持久性類型
==========================================================================
簡單控件 事件
EventManager
<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
using
System;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.ComponentModel;
namespace
MyControls
{
/**/
///
<summary>
///
SummarydescriptionforMyEventManager.
///
</summary>
[DefaultEvent(
"
NextClick
"
),DefaultProperty(
"
text
"
)]
public
class
MyEventManager:System.Web.UI.WebControls.WebControl,IPostBackEventHandler
{
public
event
EventHandlerNextClick;
public
event
EventHandlerPreClick;
[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(EventArgse)
{
if
(NextClick
!=
null
)
{
NextClick(
this
,EventArgs.Empty);
}
}
protected
virtual
void
OnPreClick(EventArgse)
{
if
(PreClick
!=
null
)
{
PreClick(
this
,EventArgs.Empty);
}
}
void
IPostBackEventHandler.RaisePostBackEvent(
string
EventArguments)
{
if
(EventArguments
==
"
Pre
"
)
{
OnPreClick(EventArgs.Empty);
Page.Trace.Warn(
"
PreButtonClick
"
);
}
else
{
OnNextClick(EventArgs.Empty);
Page.Trace.Warn(
"
NextButtonClick
"
);
}
}
[Bindable(
true
),
Category(
"
Appearance
"
),
DefaultValue(
""
)]
protected
override
void
Render(HtmlTextWriteroutput)
{
//
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);
}
}
}
組件開發(fā)中常用的屬性
更多文章、技術交流、商務合作、聯(lián)系博主
微信掃碼或搜索:z360901061
微信掃一掃加我為好友
QQ號聯(lián)系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元