using System; using System.Web.UI; using System.Web.UI.WebControls; using System.ComponentModel; using System.Collections.Specialized; namespace MyWebControls {///
// Save the value using the ViewState object, and the valid range of this object can be accessed for the current page. Finally saved on the client. Each time you will carry // viewState is a StateBag class, the stored data type has int Bool string or array and other basic data types, and ArrayList, HashTable, // or type of type converters, you can serialize Public string text {get {if (ViewState ["Value"] == null) {return string.empty;} return (string) ViewState ["value"];} set {viewState ["value"] = value;}
protected override void AddAttributesToRender (HtmlTextWriter writer) {base.AddAttributesToRender (writer); writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID); writer.AddAttribute ( "type", "text"); if (! Text = null) writer.AddAttribute ("Value", Text);
#Region iPostBackDataHandler member
/ / In order to access the return data, the server control should implement the iPostBackDataHandler interface. There are two ways public void raisePostDataChangeDevent () {// If the user returns the data changes, event IF (ONMYTEXTCHNAGED! = Null) {ONMYTEXTHNAGED (this, Eventargs .EMPTY);}}
// This method is called when there is a loopback and a control is returned, which is called for all the controls that need to access the feedback data on the page. / / This method If returned, then RaisePostDataChangeDMethod will be called after all other controls with return data on the page are called. // If it returns a holiday, it is not called. Since the incident causes an incident in this method, it is necessary to raise an event in RaisePostDataChangeDevent. // public boolLoAdPostData (String PostDataKey, NameValuey, NameValuech = false; // Do you want to trigger an email // If the last text is different from the back text is different (Text! = Postcollection [postDataKey]) { RaiseEvent = true; text = postcollection [postDataKey]; // Save the repelted value} Return RaiseEvent;} #ENDREGION
// Register an event, text change event public evenetaged;
}