AjaxHtmlSelect.cs
上传用户:szgaoree
上传日期:2009-01-05
资源大小:74k
文件大小:5k
源码类别:

Ajax

开发平台:

C#

  1. //using System;
  2. //using System.Collections.Generic;
  3. //using System.Text;
  4. //using System.Web;
  5. //using System.Web.UI;
  6. //using System.Web.UI.HtmlControls;
  7. //using System.ComponentModel;
  8. //using System.ComponentModel.Design;
  9. //using System.Web.UI.Design;
  10. //using System.Reflection;
  11. //namespace AjaxPro.Web.UI
  12. //{
  13. //    [ToolboxData("<{0}:HtmlSelect runat=server>")]
  14. //    [Designer(typeof(HtmlSelectDesigner))]
  15. //    public class AjaxHtmlSelect : System.Web.UI.WebControls.ListBox
  16. //    {
  17. //        private string m_LoadingMessage;
  18. //        public AjaxHtmlSelect() : base()
  19. //        {
  20. //        }
  21. //        [CategoryAttribute("Misc")]
  22. //        [DescriptionAttribute("Message while loading.")]
  23. //        public string LoadingMessage
  24. //        {
  25. //            get
  26. //            {
  27. //                return m_LoadingMessage;
  28. //            }
  29. //            set
  30. //            {
  31. //                m_LoadingMessage = value;
  32. //            }
  33. //        }
  34. //    }
  35. //    public class HtmlSelectDesigner : ControlDesigner
  36. //    {
  37. //        private DesignerActionListCollection al = null;
  38. //        public override DesignerActionListCollection ActionLists
  39. //        {
  40. //            get
  41. //            {
  42. //                if (al == null)
  43. //                {
  44. //                    al = new DesignerActionListCollection();
  45. //                    al.AddRange(base.ActionLists);
  46. //                    // Add a custom DesignerActionList
  47. //                    al.Add(new HtmlSelectDesignerActionList(this));
  48. //                }
  49. //                return al;
  50. //            }
  51. //        }
  52. //    }
  53. //    public class HtmlSelectDesignerActionList : DesignerActionList
  54. //    {
  55. //        HtmlSelectDesigner m_parent;
  56. //        public HtmlSelectDesignerActionList(HtmlSelectDesigner parent)
  57. //            : base(parent.Component)
  58. //        {
  59. //            m_parent = parent;
  60. //        }
  61. //        public override DesignerActionItemCollection GetSortedActionItems()
  62. //        {
  63. //            // Create list to store designer action items
  64. //            DesignerActionItemCollection actionItems = new DesignerActionItemCollection();
  65. //            // Add Appearance category header text
  66. //            //actionItems.Add(new DesignerActionHeaderItem("Misc"));
  67. //            //// Add Appearance category descriptive label
  68. //            //actionItems.Add(
  69. //            //  new DesignerActionTextItem(
  70. //            //    "Properties that affect how the User looks.",
  71. //            //    "Misc"));
  72. //            actionItems.Add(
  73. //              new DesignerActionPropertyItem(
  74. //                "LoadingMessage",
  75. //                "Loading",
  76. //                GetCategory(this.WebControl, "LoadingMessage"),
  77. //                GetDescription(this.WebControl, "LoadingMessage")));
  78. //            //actionItems.Add(
  79. //            //    new DesignerActionMethodItem(
  80. //            //    this,
  81. //            //    "ClearValues",
  82. //            //    "Clear Values",
  83. //            //    true));
  84. //            return actionItems;
  85. //        }
  86. //        #region Control Proxy Properties
  87. //        public string LoadingMessage
  88. //        {
  89. //            get { return WebControl.LoadingMessage; }
  90. //            set { SetProperty("LoadingMessage", value); }
  91. //        }
  92. //        public void ClearValues()
  93. //        {
  94. //        }
  95. //        #endregion
  96. //        private AjaxHtmlSelect WebControl
  97. //        {
  98. //            get
  99. //            {
  100. //                return (AjaxHtmlSelect)this.Component;
  101. //            }
  102. //        }
  103. //        private string GetCategory(object source, string propertyName)
  104. //        {
  105. //            PropertyInfo property = source.GetType().GetProperty(propertyName);
  106. //            CategoryAttribute attribute = (CategoryAttribute)property.GetCustomAttributes(typeof(CategoryAttribute), false)[0];
  107. //            if (attribute == null)
  108. //                return null;
  109. //            return attribute.Category;
  110. //        }
  111. //        private string GetDescription(object source, string propertyName)
  112. //        {
  113. //            PropertyInfo property = source.GetType().GetProperty(propertyName);
  114. //            DescriptionAttribute attribute = (DescriptionAttribute)property.GetCustomAttributes(typeof(DescriptionAttribute), false)[0];
  115. //            if (attribute == null)
  116. //                return null;
  117. //            return attribute.Description;
  118. //        }
  119. //        // Helper method to safely set a component抯 property
  120. //        private void SetProperty(string propertyName, object value)
  121. //        {
  122. //            // Get property
  123. //            PropertyDescriptor property = TypeDescriptor.GetProperties(this.WebControl)[propertyName];
  124. //            // Set property value
  125. //            property.SetValue(this.WebControl, value);
  126. //        }
  127. //    }
  128. //}