实现了IPostBackEventHandler接口的TextBox

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;

namespace PEONormalControl
... {
/**/ ///

1<summary>   
2![](http://www.actiprosoftware.com/Images/OutliningIndicators/InBlock.gif) ///  回传事件参数类型   
3![](http://www.actiprosoftware.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif) ///  </summary>

public class EventTextBoxEventArgs:EventArgs
... {
private string _ToAppend;
EventTextBoxEventArgs()
... {

}
public EventTextBoxEventArgs(String ArgText)
... {
this ._ToAppend = ArgText;
}
/**/ ///

1<summary>   
2![](http://www.actiprosoftware.com/Images/OutliningIndicators/InBlock.gif) ///  回传事件参数   
3![](http://www.actiprosoftware.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif) ///  </summary>

public String ArgText
... {
get ... { return _ToAppend;}
set ... {_ToAppend = value;}
}
}
/**/ ///

1<summary>   
2![](http://www.actiprosoftware.com/Images/OutliningIndicators/InBlock.gif) ///  从TextBox继承,实现了IPostBackEventHandler接口   
3![](http://www.actiprosoftware.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif) ///  </summary>

[DefaultProperty( " Text " ),
ToolboxData( " <{0}:EventTextBox runat=server>

" )]
public class EventTextBox : System.Web.UI.WebControls.TextBox,IPostBackEventHandler
... {
// private string text;
private static readonly object objEventChangedKey;
public delegate void EventChangedHandler( object sender,EventTextBoxEventArgs e);

[Bindable( false ),
Category( " Appearance " ),
DefaultValue( "" )]
public string PrefixText
... {
get
... { if (ViewState[ " PrefixText " ] == null )
return "" ;
else
return ViewState[ " PrefixText " ].ToString() ;
}

set
... {
ViewState[ " PrefixText " ] = value;
}
}
/**/ ///

1<summary>   
2![](http://www.actiprosoftware.com/Images/OutliningIndicators/InBlock.gif) ///  引起回传的事件名称   
3![](http://www.actiprosoftware.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif) ///  </summary>

[Bindable( false ),
Category( " Behavior " ),
DefaultValue( "" ),Description( " 引起回传的事件名称 " )]
public string EventName
... {
get
... { if (ViewState[ " EventName " ] == null )
return "" ;
else
return ViewState[ " EventName " ].ToString() ;
}

set
... {
ViewState[ " EventName " ] = value;
}
}
/**/ ///

1<summary>   
2![](http://www.actiprosoftware.com/Images/OutliningIndicators/InBlock.gif) ///  回传事件参数   
3![](http://www.actiprosoftware.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif) ///  </summary>

[Bindable( false ),
Category( " Behavior " ),
DefaultValue( "" ),Description( " 回传事件参数 " )]
public string EventArgText
... {
get
... { if (ViewState[ " EventArgText " ] == null )
return "" ;
else
return ViewState[ " EventArgText " ].ToString() ;
}

set
... {
ViewState[ " EventArgText " ] = value;
}
}
/**/ ///

1<summary>   
2![](http://www.actiprosoftware.com/Images/OutliningIndicators/InBlock.gif) ///  用户自定义的回传函数   
3![](http://www.actiprosoftware.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif) ///  </summary>

[Bindable( false ),
Category( " Behavior " ),
DefaultValue( "" ),Description( " 用户自定义的回传函数,为空则使用标准的回传函数 " )]
public String UserPostBackFunction
... {
get
... { if (ViewState[ " UserPostBackFunction " ] == null )
return "" ;
else
return ViewState[ " UserPostBackFunction " ].ToString() ;
}

set
... {
ViewState[ " UserPostBackFunction " ] = value;
}
}
protected virtual void OnEventChanged(EventTextBoxEventArgs e)
... {
EventChangedHandler handler1 = (EventChangedHandler) base .Events[objEventChangedKey];
if (handler1 != null )
... {
handler1( this , e);
}
}
public void RemoveStateView(String strKey)
... {
this .ViewState.Remove(strKey);
}
[Description( " EventTextBox_OnEventChanged " ), Category( " Action " )]
public event EventChangedHandler EventChanged
<img id="Highlighter_2770_2924_Open_Image" onclick="this.style.display='none'; Highlighter_2770_2924_Open_Text.style.display='none'; Highlighter_2770_2924_Closed_Image.style.display='inline'; Highlighter_2770_2924_Closed_Text.style.display='inline';" src="http://www.actiprosoftware.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" alt

Published At
Categories with Web编程
Tagged with
comments powered by Disqus