1 /* System.Web.UI.HtmlControls
3 * Leen Toelen (toelen@hotmail.com)
9 using System.ComponentModel;
10 using System.Globalization;
11 using System.Collections.Specialized;
13 namespace System.Web.UI.HtmlControls{
15 public class HtmlTextArea : HtmlContainerControl, IPostBackDataHandler{
17 private static readonly object EventServerChange;
19 public HtmlTextArea(): base("textarea"){}
23 string attr = Attributes["cols"];
25 return Int32.Parse(attr, CultureInfo.InvariantCulture);
30 //MapIntegerAttributeToString(value) accessible constraint is "assembly"
31 Attributes["cols"] = MapIntegerAttributeToString(value);
37 string attr = Attributes["rows"];
39 return Int32.Parse(attr, CultureInfo.InvariantCulture);;
44 //MapIntegerAttributeToString(value) accessible constraint is "assembly"
45 Attributes["rows"] = MapIntegerAttributeToString(value);
58 protected string RenderedNameAttribute{
64 public virtual string Name{
66 if (UniqueID != null){
74 public event EventHandler ServerChange{
76 Events.AddHandler(EventServerChange, value);
79 Events.RemoveHandler(EventServerChange, value);
83 protected virtual void OnServerChange(EventArgs e){
85 handler = (EventHandler) Events[EventServerChange];
87 handler.Invoke(this, e);
91 //FIXME: not sure about the accessor
92 public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
93 string currentValue = Value;
94 string postedValue = postCollection[postDataKey];
95 if (!currentValue.Equals(postedValue) && currentValue != null){
96 Value = HttpUtility.HtmlEncode(postedValue);
103 protected override void RenderAttributes(HtmlTextWriter writer){
104 writer.WriteAttribute("name", RenderedNameAttribute);
105 base.Attributes.Remove("name");
106 base.RenderAttributes(writer);
109 //FIXME: not sure about the accessor
110 public void RaisePostDataChangedEvent(){
111 OnServerChange(EventArgs.Empty);
114 protected override void OnPreRender(EventArgs e){
115 if(Events[EventServerChange]==null || Disabled==true){
116 ViewState.SetItemDirty("value",false);
120 protected override void AddParsedSubObject(object obj){
121 //FIXME: not sure about this function
122 if (obj is LiteralControl || obj is DataBoundLiteralControl){
123 AddParsedSubObject(obj);
126 //FormatResourceString accessible constraint is "assembly"
127 throw new HttpException(HttpRuntime.FormatResourceString("Cannot_Have_Children_Of_Type","HtmlTextArea",obj.GetType.Name));
130 } // class HtmlTextArea
131 } // namespace System.Web.UI.HtmlControls