控件生命周期

第一次加载主要事件如下:
1:TrackViewState
2:OnPreRender
3:SaveViewState()
4:Render

回传时页面加载主要事件如下:

page.isPostBack
1:TrackViewState
2:LoadViewState
3:LoadPostData
4:RaisePostDataChangedEvent
5RaisePostBackEvent
6:OnPreRender
7:SaveViewState
8:Render
如果要回传。在Render的PostBackOptions的AutoPostBack = true;
如果要加载数据。在OnPreRender加this.Page.RegisterRequiresPostBack(this);

事例:

  1 None.gif using  System;
  2 None.gif using  System.Collections.Specialized;
  3 None.gif using  System.ComponentModel;
  4 None.gif using  System.Globalization;
  5 None.gif using  System.Security.Permissions;
  6 None.gif using  System.Web;
  7 None.gif using  System.Web.UI;
  8 None.gif using  System.Web.UI.WebControls;
  9 None.gif
 10 None.gif[assembly: TagPrefix( " Invent.Controls " " Invent " )]
 11 None.gif namespace  InventControls
 12 ExpandedBlockStart.gifContractedBlock.gif dot.gif {
 13InBlock.gif   // [SupportsEventValidation, ControlValueProperty("Checked"), DataBindingHandler("System.Web.UI.Design.TextDataBindingHandler, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), DefaultEvent("CheckedChanged"), Designer("System.Web.UI.Design.WebControls.CheckBoxDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), DefaultProperty("Text"), AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
 14InBlock.gif    public class InventCheckBox : WebControl, IPostBackDataHandler, ICheckBoxControl
 15ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
 16InBlock.gif        [Description("Control_OnServerCheckChanged"), Category("Action")]
 17InBlock.gif        public event EventHandler CheckedChanged
 18ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 19InBlock.gif            add
 20ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 21InBlock.gif                base.Events.AddHandler(InventCheckBox.EventCheckedChanged, value);
 22ExpandedSubBlockEnd.gif            }

 23InBlock.gif            remove
 24ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 25InBlock.gif                base.Events.RemoveHandler(InventCheckBox.EventCheckedChanged, value);
 26ExpandedSubBlockEnd.gif            }

 27ExpandedSubBlockEnd.gif        }

 28InBlock.gif
 29InBlock.gif        static InventCheckBox()
 30ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 31InBlock.gif            InventCheckBox.EventCheckedChanged = new object();
 32ExpandedSubBlockEnd.gif        }

 33InBlock.gif
 34InBlock.gif        public InventCheckBox() : base(HtmlTextWriterTag.Input)
 35ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 36ExpandedSubBlockEnd.gif        }

 37InBlock.gif
 38InBlock.gif        protected override void AddAttributesToRender(HtmlTextWriter writer)
 39ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 40InBlock.gif            //base.AddDisplayInlineBlockIfNeeded(writer);
 41ExpandedSubBlockEnd.gif        }

 42InBlock.gif
 43InBlock.gif        protected virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection)
 44ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 45InBlock.gif            bool flag1 = false;
 46InBlock.gif            string text1 = postCollection[postDataKey];
 47InBlock.gif            bool flag2 = !string.IsNullOrEmpty(text1);
 48InBlock.gif            if (flag2)
 49ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 50InBlock.gif                //base.ValidateEvent(postDataKey);
 51ExpandedSubBlockEnd.gif            }

 52InBlock.gif            flag1 = flag2 != this.Checked;
 53InBlock.gif            this.Checked = flag2;
 54InBlock.gif            return flag1;
 55ExpandedSubBlockEnd.gif        }

 56InBlock.gif
 57InBlock.gif        protected override void LoadViewState(object savedState)
 58ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 59InBlock.gif            if (savedState != null)
 60ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 61InBlock.gif                Triplet triplet1 = (Triplet) savedState;
 62InBlock.gif                base.LoadViewState(triplet1.First);
 63InBlock.gif                if (triplet1.Second != null)
 64ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
 65InBlock.gif                    if (this._inputAttributesState == null)
 66ExpandedSubBlockStart.gifContractedSubBlock.gif                    dot.gif{
 67InBlock.gif                        this._inputAttributesState = new StateBag();
 68InBlock.gif                        ((IStateManager)this._inputAttributesState).TrackViewState();
 69ExpandedSubBlockEnd.gif                    }

 70InBlock.gif                    ((IStateManager)this._inputAttributesState).LoadViewState(triplet1.Second);
 71ExpandedSubBlockEnd.gif                }

 72InBlock.gif                if (triplet1.Third != null)
 73ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
 74InBlock.gif                    if (this._labelAttributesState == null)
 75ExpandedSubBlockStart.gifContractedSubBlock.gif                    dot.gif{
 76InBlock.gif                        this._labelAttributesState = new StateBag();
 77InBlock.gif                        ((IStateManager)this._labelAttributesState).TrackViewState();
 78ExpandedSubBlockEnd.gif                    }

 79InBlock.gif                    ((IStateManager)this._labelAttributesState).LoadViewState(triplet1.Second);
 80ExpandedSubBlockEnd.gif                }

 81ExpandedSubBlockEnd.gif            }

 82ExpandedSubBlockEnd.gif        }

 83InBlock.gif
 84InBlock.gif        protected virtual void OnCheckedChanged(EventArgs e)
 85ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 86InBlock.gif            EventHandler handler1 = (EventHandler) base.Events[InventCheckBox.EventCheckedChanged];
 87InBlock.gif            if (handler1 != null)
 88ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 89InBlock.gif                handler1(this, e);
 90ExpandedSubBlockEnd.gif            }

 91ExpandedSubBlockEnd.gif        }

 92InBlock.gif
 93InBlock.gif        protected override void OnPreRender(EventArgs e)
 94ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 95InBlock.gif            base.OnPreRender(e);
 96InBlock.gif            bool flag1 = this.AutoPostBack;
 97InBlock.gif            if ((this.Page != null&& base.IsEnabled)
 98ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 99InBlock.gif                this.Page.RegisterRequiresPostBack(this);
100InBlock.gif                //if (flag1)
101InBlock.gif                //{
102InBlock.gif                //    this.Page.RegisterPostBackScript();
103InBlock.gif                //    this.Page.RegisterFocusScript();
104InBlock.gif                //    if (this.CausesValidation && (this.Page.GetValidators(this.ValidationGroup).Count > 0))
105InBlock.gif                //    {
106InBlock.gif                //        this.Page.RegisterWebFormsScript();
107InBlock.gif                //    }
108InBlock.gif                //}
109ExpandedSubBlockEnd.gif            }

110InBlock.gif            if (!this.SaveCheckedViewState(flag1))
111ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
112InBlock.gif                this.ViewState.SetItemDirty("Checked"false);
113InBlock.gif                //if ((this.Page != null) && base.IsEnabled)
114InBlock.gif                //{
115InBlock.gif                //    this.Page.RegisterEnabledControl(this);
116InBlock.gif                //}
117ExpandedSubBlockEnd.gif            }

118ExpandedSubBlockEnd.gif        }

119InBlock.gif
120InBlock.gif        protected virtual void RaisePostDataChangedEvent()
121ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
122InBlock.gif            if (this.AutoPostBack)
123ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
124InBlock.gif                //this.Page.AutoPostBackControl = this;
125InBlock.gif                if (this.CausesValidation)
126ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
127InBlock.gif                    this.Page.Validate(this.ValidationGroup);
128ExpandedSubBlockEnd.gif                }

129ExpandedSubBlockEnd.gif            }

130InBlock.gif            this.OnCheckedChanged(EventArgs.Empty);
131ExpandedSubBlockEnd.gif        }

132InBlock.gif
133InBlock.gif        protected override void Render(HtmlTextWriter writer)
134ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
135InBlock.gif            this.AddAttributesToRender(writer);
136InBlock.gif            if (this.Page != null)
137ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
138InBlock.gif                this.Page.VerifyRenderingInServerForm(this);
139ExpandedSubBlockEnd.gif            }

140InBlock.gif            bool flag1 = false;
141InBlock.gif            if (base.ControlStyleCreated)
142ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
143InBlock.gif                Style style1 = base.ControlStyle;
144InBlock.gif                if (!style1.IsEmpty)
145ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
146InBlock.gif                    style1.AddAttributesToRender(writer, this);
147InBlock.gif                    flag1 = true;
148ExpandedSubBlockEnd.gif                }

149ExpandedSubBlockEnd.gif            }

150InBlock.gif            if (!base.IsEnabled)
151ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
152InBlock.gif                writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled");
153InBlock.gif                flag1 = true;
154ExpandedSubBlockEnd.gif            }

155InBlock.gif            string text1 = this.ToolTip;
156InBlock.gif            if (text1.Length > 0)
157ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
158InBlock.gif                writer.AddAttribute(HtmlTextWriterAttribute.Title, text1);
159InBlock.gif                flag1 = true;
160ExpandedSubBlockEnd.gif            }

161InBlock.gif            string text2 = null;
162InBlock.gif            if (base.HasAttributes)
163ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
164InBlock.gif                System.Web.UI.AttributeCollection collection1 = base.Attributes;
165InBlock.gif                string text3 = collection1["value"];
166InBlock.gif                if (text3 != null)
167ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
168InBlock.gif                    collection1.Remove("value");
169ExpandedSubBlockEnd.gif                }

170InBlock.gif                text2 = collection1["onclick"];
171InBlock.gif                if (text2 != null)
172ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
173InBlock.gif                    text2 = Util.EnsureEndWithSemiColon(text2);
174InBlock.gif                    collection1.Remove("onclick");
175ExpandedSubBlockEnd.gif                }

176InBlock.gif                if (collection1.Count != 0)
177ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
178InBlock.gif                    collection1.AddAttributes(writer);
179InBlock.gif                    flag1 = true;
180ExpandedSubBlockEnd.gif                }

181InBlock.gif                if (text3 != null)
182ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
183InBlock.gif                    collection1["value"= text3;
184ExpandedSubBlockEnd.gif                }

185ExpandedSubBlockEnd.gif            }

186InBlock.gif            if (flag1)
187ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
188InBlock.gif                writer.RenderBeginTag(HtmlTextWriterTag.Span);
189ExpandedSubBlockEnd.gif            }

190InBlock.gif            string text4 = this.Text;
191InBlock.gif            string text5 = this.ClientID;
192InBlock.gif            if (text4.Length != 0)
193ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
194InBlock.gif                if (this.TextAlign == System.Web.UI.WebControls.TextAlign.Left)
195ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
196InBlock.gif                    this.RenderLabel(writer, text4, text5);
197InBlock.gif                    this.RenderInputTag(writer, text5, text2);
198ExpandedSubBlockEnd.gif                }

199InBlock.gif                else
200ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
201InBlock.gif                    this.RenderInputTag(writer, text5, text2);
202InBlock.gif                    this.RenderLabel(writer, text4, text5);
203ExpandedSubBlockEnd.gif                }

204ExpandedSubBlockEnd.gif            }

205InBlock.gif            else
206ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
207InBlock.gif                this.RenderInputTag(writer, text5, text2);
208ExpandedSubBlockEnd.gif            }

209InBlock.gif            if (flag1)
210ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
211InBlock.gif                writer.RenderEndTag();
212ExpandedSubBlockEnd.gif            }

213ExpandedSubBlockEnd.gif        }

214InBlock.gif
215InBlock.gif        internal virtual void RenderInputTag(HtmlTextWriter writer, string clientID, string onClick)
216ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
217InBlock.gif            if (clientID != null)
218ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
219InBlock.gif                writer.AddAttribute(HtmlTextWriterAttribute.Id, clientID);
220ExpandedSubBlockEnd.gif            }

221InBlock.gif            writer.AddAttribute(HtmlTextWriterAttribute.Type, "checkbox");
222InBlock.gif            if (this.UniqueID != null)
223ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
224InBlock.gif                writer.AddAttribute(HtmlTextWriterAttribute.Name, this.UniqueID);
225ExpandedSubBlockEnd.gif            }

226InBlock.gif            if (this._valueAttribute != null)
227ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
228InBlock.gif                writer.AddAttribute(HtmlTextWriterAttribute.Value, this._valueAttribute);
229ExpandedSubBlockEnd.gif            }

230InBlock.gif            if (this.Checked)
231ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
232InBlock.gif                writer.AddAttribute(HtmlTextWriterAttribute.Checked, "checked");
233ExpandedSubBlockEnd.gif            }

234InBlock.gif            if (!base.IsEnabled)
235ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
236InBlock.gif                writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled");
237ExpandedSubBlockEnd.gif            }

238InBlock.gif            if ((this.AutoPostBack && (this.Page != null)))
239ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
240InBlock.gif                PostBackOptions options1 = new PostBackOptions(thisstring.Empty);
241InBlock.gif                if (this.CausesValidation && (this.Page.GetValidators(this.ValidationGroup).Count > 0))
242ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
243InBlock.gif                    options1.PerformValidation = true;
244InBlock.gif                    options1.ValidationGroup = this.ValidationGroup;
245ExpandedSubBlockEnd.gif                }

246InBlock.gif                if (this.Page.Form != null)
247ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
248InBlock.gif                    options1.AutoPostBack = true;
249ExpandedSubBlockEnd.gif                }

250InBlock.gif                onClick = Util.MergeScript(onClick, this.Page.ClientScript.GetPostBackEventReference(options1, true));
251InBlock.gif                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, onClick);
252InBlock.gif               
253ExpandedSubBlockEnd.gif            }

254InBlock.gif            else
255ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
256InBlock.gif                if (this.Page != null)
257ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
258InBlock.gif                    this.Page.ClientScript.RegisterForEventValidation(this.UniqueID);
259ExpandedSubBlockEnd.gif                }

260InBlock.gif                if (onClick != null)
261ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
262InBlock.gif                    writer.AddAttribute(HtmlTextWriterAttribute.Onclick, onClick);
263ExpandedSubBlockEnd.gif                }

264ExpandedSubBlockEnd.gif            }

265InBlock.gif            string text1 = this.AccessKey;
266InBlock.gif            if (text1.Length > 0)
267ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
268InBlock.gif                writer.AddAttribute(HtmlTextWriterAttribute.Accesskey, text1);
269ExpandedSubBlockEnd.gif            }

270InBlock.gif            int num1 = this.TabIndex;
271InBlock.gif            if (num1 != 0)
272ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
273InBlock.gif                writer.AddAttribute(HtmlTextWriterAttribute.Tabindex, num1.ToString(NumberFormatInfo.InvariantInfo));
274ExpandedSubBlockEnd.gif            }

275InBlock.gif            if ((this._inputAttributes != null&& (this._inputAttributes.Count != 0))
276ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
277InBlock.gif                this._inputAttributes.AddAttributes(writer);
278ExpandedSubBlockEnd.gif            }

279InBlock.gif            writer.RenderBeginTag(HtmlTextWriterTag.Input);
280InBlock.gif            writer.RenderEndTag();
281ExpandedSubBlockEnd.gif        }

282InBlock.gif
283InBlock.gif        private void RenderLabel(HtmlTextWriter writer, string text, string clientID)
284ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
285InBlock.gif            writer.AddAttribute(HtmlTextWriterAttribute.For, clientID);
286InBlock.gif            if ((this._labelAttributes != null&& (this._labelAttributes.Count != 0))
287ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
288InBlock.gif                this._labelAttributes.AddAttributes(writer);
289ExpandedSubBlockEnd.gif            }

290InBlock.gif            writer.RenderBeginTag(HtmlTextWriterTag.Label);
291InBlock.gif            writer.Write(text);
292InBlock.gif            writer.RenderEndTag();
293ExpandedSubBlockEnd.gif        }

294InBlock.gif
295InBlock.gif        private bool SaveCheckedViewState(bool autoPostBack)
296ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
297InBlock.gif            if ((((base.Events[InventCheckBox.EventCheckedChanged] != null|| !base.IsEnabled) || !this.Visible) || ((autoPostBack && (this.Page != null))))
298ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
299InBlock.gif                return true;
300ExpandedSubBlockEnd.gif            }

301InBlock.gif            Type type1 = base.GetType();
302InBlock.gif            if ((type1 != typeof(InventCheckBox)) && (type1 != typeof(RadioButton)))
303ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
304InBlock.gif                return true;
305ExpandedSubBlockEnd.gif            }

306InBlock.gif            return false;
307ExpandedSubBlockEnd.gif        }

308InBlock.gif
309InBlock.gif        protected override object SaveViewState()
310ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
311InBlock.gif            object obj1 = base.SaveViewState();
312InBlock.gif            object obj2 = null;
313InBlock.gif            object obj3 = null;
314InBlock.gif            object obj4 = null;
315InBlock.gif            if (this._inputAttributesState != null)
316ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
317InBlock.gif                obj2 = ((IStateManager)this._inputAttributesState).SaveViewState();
318ExpandedSubBlockEnd.gif            }

319InBlock.gif            if (this._labelAttributesState != null)
320ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
321InBlock.gif                obj3 = ((IStateManager)this._labelAttributesState).SaveViewState();
322ExpandedSubBlockEnd.gif            }

323InBlock.gif            if (((obj1 == null&& (obj2 == null)) && (obj3 == null))
324ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
325InBlock.gif                return obj4;
326ExpandedSubBlockEnd.gif            }

327InBlock.gif            return new Triplet(obj1, obj2, obj3);
328ExpandedSubBlockEnd.gif        }

329InBlock.gif
330InBlock.gif        bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
331ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
332InBlock.gif            return this.LoadPostData(postDataKey, postCollection);
333ExpandedSubBlockEnd.gif        }

334InBlock.gif
335InBlock.gif        void IPostBackDataHandler.RaisePostDataChangedEvent()
336ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
337InBlock.gif            this.RaisePostDataChangedEvent();
338ExpandedSubBlockEnd.gif        }

339InBlock.gif
340InBlock.gif        protected override void TrackViewState()
341ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
342InBlock.gif            base.TrackViewState();
343InBlock.gif            if (this._inputAttributesState != null)
344ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
345InBlock.gif               ((IStateManager) this._inputAttributesState).TrackViewState();
346ExpandedSubBlockEnd.gif            }

347InBlock.gif            if (this._labelAttributesState != null)
348ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
349InBlock.gif                ((IStateManager)this._labelAttributesState).TrackViewState();
350ExpandedSubBlockEnd.gif            }

351ExpandedSubBlockEnd.gif        }

352InBlock.gif
353InBlock.gif
354InBlock.gif        [DefaultValue(false), Category("Behavior"), Description("CheckBox_AutoPostBack"), Themeable(false)]
355InBlock.gif        public virtual bool AutoPostBack
356ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
357InBlock.gif            get
358ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
359InBlock.gif                object obj1 = this.ViewState["AutoPostBack"];
360InBlock.gif                if (obj1 != null)
361ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
362InBlock.gif                    return (bool) obj1;
363ExpandedSubBlockEnd.gif                }

364InBlock.gif                return false;
365ExpandedSubBlockEnd.gif            }

366InBlock.gif            set
367ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
368InBlock.gif                this.ViewState["AutoPostBack"= value;
369ExpandedSubBlockEnd.gif            }

370ExpandedSubBlockEnd.gif        }

371InBlock.gif
372InBlock.gif        [DefaultValue(false), Themeable(false), Category("Behavior"), Description("AutoPostBackControl_CausesValidation")]
373InBlock.gif        public virtual bool CausesValidation
374ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
375InBlock.gif            get
376ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
377InBlock.gif                object obj1 = this.ViewState["CausesValidation"];
378InBlock.gif                if (obj1 != null)
379ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
380InBlock.gif                    return (bool) obj1;
381ExpandedSubBlockEnd.gif                }

382InBlock.gif                return false;
383ExpandedSubBlockEnd.gif            }

384InBlock.gif            set
385ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
386InBlock.gif                this.ViewState["CausesValidation"= value;
387ExpandedSubBlockEnd.gif            }

388ExpandedSubBlockEnd.gif        }

389InBlock.gif
390InBlock.gif        [Description("CheckBox_Checked"), Bindable(true, BindingDirection.TwoWay), DefaultValue(false), Themeable(false)]
391InBlock.gif        public virtual bool Checked
392ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
393InBlock.gif            get
394ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
395InBlock.gif                object obj1 = this.ViewState["Checked"];
396InBlock.gif                if (obj1 != null)
397ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
398InBlock.gif                    return (bool) obj1;
399ExpandedSubBlockEnd.gif                }

400InBlock.gif                return false;
401ExpandedSubBlockEnd.gif            }

402InBlock.gif            set
403ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
404InBlock.gif                this.ViewState["Checked"= value;
405ExpandedSubBlockEnd.gif            }

406ExpandedSubBlockEnd.gif        }

407InBlock.gif
408InBlock.gif        [Browsable(false), Description("CheckBox_InputAttributes"), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
409InBlock.gif        public System.Web.UI.AttributeCollection InputAttributes
410ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
411InBlock.gif            get
412ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
413InBlock.gif                if (this._inputAttributes == null)
414ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
415InBlock.gif                    if (this._inputAttributesState == null)
416ExpandedSubBlockStart.gifContractedSubBlock.gif                    dot.gif{
417InBlock.gif                        this._inputAttributesState = new StateBag(true);
418InBlock.gif                        if (base.IsTrackingViewState)
419ExpandedSubBlockStart.gifContractedSubBlock.gif                        dot.gif{
420InBlock.gif                            ((IStateManager)this._inputAttributesState).TrackViewState();
421ExpandedSubBlockEnd.gif                        }

422ExpandedSubBlockEnd.gif                    }

423InBlock.gif                    this._inputAttributes = new System.Web.UI.AttributeCollection(this._inputAttributesState);
424ExpandedSubBlockEnd.gif                }

425InBlock.gif                return this._inputAttributes;
426ExpandedSubBlockEnd.gif            }

427ExpandedSubBlockEnd.gif        }

428InBlock.gif
429InBlock.gif        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Description("CheckBox_LabelAttributes"), Browsable(false)]
430InBlock.gif        public System.Web.UI.AttributeCollection LabelAttributes
431ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
432InBlock.gif            get
433ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
434InBlock.gif                if (this._labelAttributes == null)
435ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
436InBlock.gif                    if (this._labelAttributesState == null)
437ExpandedSubBlockStart.gifContractedSubBlock.gif                    dot.gif{
438InBlock.gif                        this._labelAttributesState = new StateBag(true);
439InBlock.gif                        if (base.IsTrackingViewState)
440ExpandedSubBlockStart.gifContractedSubBlock.gif                        dot.gif{
441InBlock.gif                            ((IStateManager)this._labelAttributesState).TrackViewState();
442ExpandedSubBlockEnd.gif                        }

443ExpandedSubBlockEnd.gif                    }

444InBlock.gif                    this._labelAttributes = new System.Web.UI.AttributeCollection(this._labelAttributesState);
445ExpandedSubBlockEnd.gif                }

446InBlock.gif                return this._labelAttributes;
447ExpandedSubBlockEnd.gif            }

448ExpandedSubBlockEnd.gif        }

449InBlock.gif
450InBlock.gif        //protected override bool RequiresLegacyRendering
451InBlock.gif        //{
452InBlock.gif        //    get
453InBlock.gif        //    {
454InBlock.gif        //        return true;
455InBlock.gif        //    }
456InBlock.gif        //}
457InBlock.gif
458InBlock.gif        [Bindable(true), Localizable(true), Description("CheckBox_Text"), Category("Appearance"), DefaultValue("")]
459InBlock.gif        public virtual string Text
460ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
461InBlock.gif            get
462ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
463InBlock.gif                string text1 = (stringthis.ViewState["Text"];
464InBlock.gif                if (text1 != null)
465ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
466InBlock.gif                    return text1;
467ExpandedSubBlockEnd.gif                }

468InBlock.gif                return string.Empty;
469ExpandedSubBlockEnd.gif            }

470InBlock.gif            set
471ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
472InBlock.gif                this.ViewState["Text"= value;
473ExpandedSubBlockEnd.gif            }

474ExpandedSubBlockEnd.gif        }

475InBlock.gif
476InBlock.gif        [DefaultValue(2), Category("Appearance"), Description("WebControl_TextAlign")]
477InBlock.gif        public virtual System.Web.UI.WebControls.TextAlign TextAlign
478ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
479InBlock.gif            get
480ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
481InBlock.gif                object obj1 = this.ViewState["TextAlign"];
482InBlock.gif                if (obj1 != null)
483ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
484InBlock.gif                    return (System.Web.UI.WebControls.TextAlign) obj1;
485ExpandedSubBlockEnd.gif                }

486InBlock.gif                return System.Web.UI.WebControls.TextAlign.Right;
487ExpandedSubBlockEnd.gif            }

488InBlock.gif            set
489ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
490InBlock.gif                if ((value < System.Web.UI.WebControls.TextAlign.Left) || (value > System.Web.UI.WebControls.TextAlign.Right))
491ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
492InBlock.gif                    throw new ArgumentOutOfRangeException("value");
493ExpandedSubBlockEnd.gif                }

494InBlock.gif                this.ViewState["TextAlign"= value;
495ExpandedSubBlockEnd.gif            }

496ExpandedSubBlockEnd.gif        }

497InBlock.gif
498InBlock.gif        [DefaultValue(""), Themeable(false), Category("Behavior"), Description("PostBackControl_ValidationGroup")]
499InBlock.gif        public virtual string ValidationGroup
500ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
501InBlock.gif            get
502ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
503InBlock.gif                string text1 = (stringthis.ViewState["ValidationGroup"];
504InBlock.gif                if (text1 != null)
505ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
506InBlock.gif                    return text1;
507ExpandedSubBlockEnd.gif                }

508InBlock.gif                return string.Empty;
509ExpandedSubBlockEnd.gif            }

510InBlock.gif            set
511ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
512InBlock.gif                this.ViewState["ValidationGroup"= value;
513ExpandedSubBlockEnd.gif            }

514ExpandedSubBlockEnd.gif        }

515InBlock.gif
516InBlock.gif
517InBlock.gif        internal System.Web.UI.AttributeCollection _inputAttributes;
518InBlock.gif        private StateBag _inputAttributesState;
519InBlock.gif        private System.Web.UI.AttributeCollection _labelAttributes;
520InBlock.gif        private StateBag _labelAttributesState;
521InBlock.gif        private string _valueAttribute;
522InBlock.gif        private static readonly object EventCheckedChanged;
523ExpandedSubBlockEnd.gif    }

524ExpandedBlockEnd.gif}

525 None.gif
526 None.gif
 

转载于:https://www.cnblogs.com/KUDO/archive/2006/07/07/445500.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值