2
0

HtmlInputHidden.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* System.Web.UI.HtmlControls
  2. * Authors
  3. * Leen Toelen ([email protected])
  4. */
  5. using System;
  6. using System.Web;
  7. using System.Web.UI;
  8. using System.Globalization;
  9. using System.Collections.Specialized;
  10. namespace System.Web.UI.HtmlControls{
  11. public class HtmlInputHidden : HtmlInputControl, IPostBackDataHandler{
  12. private static readonly object EventServerChange;
  13. public HtmlInputHidden(string type):base("hidden"){}
  14. public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
  15. string postValue = postCollection[postDataKey];
  16. if (postValue != null)
  17. Value = postValue;
  18. return false;
  19. }
  20. public virtual void RaisePostDataChangedEvent(){
  21. OnServerChange(EventArgs.Empty);
  22. }
  23. protected void OnServerChange(EventArgs e){
  24. EventHandler handler = (EventHandler) Events[EventServerChange];
  25. if (handler != null) handler.Invoke(this, e);
  26. }
  27. protected override void OnPreRender(EventArgs e){
  28. if (Events[EventServerChange] != null && !Disabled)
  29. ViewState.SetItemDirty("value",false);
  30. }
  31. public event EventHandler ServerChange{
  32. add{
  33. Events.AddHandler(EventServerChange, value);
  34. }
  35. remove{
  36. Events.RemoveHandler(EventServerChange, value);
  37. }
  38. }
  39. } // class HtmlInputFile
  40. } // namespace System.Web.UI.HtmlControls