**** Merged from MCS ****
[mono-project.git] / mcs / class / System.Web / System.Web.UI.HtmlControls / HtmlInputHidden.cs
blob577d3c0f7e52538662397e409cf6e81fd1916270
1 /* System.Web.UI.HtmlControls
2 * Authors
3 * Leen Toelen (toelen@hotmail.com)
4 */
6 using System;
7 using System.Collections.Specialized;
8 using System.ComponentModel;
9 using System.Globalization;
10 using System.Web;
11 using System.Web.UI;
13 namespace System.Web.UI.HtmlControls{
15 [DefaultEvent("ServerChange")]
16 public class HtmlInputHidden : HtmlInputControl, IPostBackDataHandler{
18 private static readonly object EventServerChange = new object ();
20 public HtmlInputHidden () : base ("hidden")
24 bool IPostBackDataHandler.LoadPostData (string postDataKey,
25 NameValueCollection postCollection)
27 string postValue = postCollection [postDataKey];
28 if (postValue != null)
29 Value = postValue;
30 return false;
33 void IPostBackDataHandler.RaisePostDataChangedEvent ()
35 // don't need anything. LoadPostData always returns false.
38 protected virtual void OnServerChange (EventArgs e)
40 EventHandler handler = (EventHandler) Events [EventServerChange];
41 if (handler != null)
42 handler (this, e);
45 protected override void OnPreRender(EventArgs e){
46 if (Events[EventServerChange] != null && !Disabled)
47 ViewState.SetItemDirty("value",false);
50 [WebCategory("Action")]
51 [WebSysDescription("Fires when the value of the control changes.")]
52 public event EventHandler ServerChange{
53 add{
54 Events.AddHandler(EventServerChange, value);
56 remove{
57 Events.RemoveHandler(EventServerChange, value);
61 } // class HtmlInputFile
62 } // namespace System.Web.UI.HtmlControls