2 // System.Web.UI.WebControls.Panel.cs
5 // Gaurav Vaish (gvaish@iitk.ac.in)
6 // Andreas Nahr (ClassDevelopment@A-SoftTech.com)
8 // (C) Gaurav Vaish (2002)
9 // (C) 2003 Andreas Nahr
13 using System.ComponentModel;
14 using System.ComponentModel.Design;
\r
16 using System.Web.UI;
\r
18 namespace System.Web.UI.WebControls
\r
20 [Designer ("System.Web.UI.Design.WebControls.PanelDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
\r
21 [ParseChildren(false)]
\r
22 [PersistChildren(true)]
\r
23 [ToolboxData("<{0}:Panel runat=\"server\">Panel</{0}:Panel>")]
\r
24 public class Panel: WebControl
\r
26 public Panel(): base(HtmlTextWriterTag.Div)
\r
30 [DefaultValue (""), Bindable (true), WebCategory ("Appearance")]
31 [Editor ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
32 [WebSysDescription ("An Url specifying the background image for the panel.")]
\r
33 public virtual string BackImageUrl
\r
37 object o = ViewState["BackImageUrl"];
\r
40 return String.Empty;
\r
44 ViewState["BackImageUrl"] = value;
\r
48 [DefaultValue (typeof (HorizontalAlign), "NotSet"), Bindable (true), WebCategory ("Layout")]
49 [WebSysDescription ("The horizonal alignment of the panel.")]
\r
50 public virtual HorizontalAlign HorizontalAlign
\r
54 object o = ViewState["HorizontalAlign"];
\r
56 return (HorizontalAlign)o;
\r
57 return HorizontalAlign.NotSet;
\r
61 if(!Enum.IsDefined(typeof(HorizontalAlign), value))
\r
63 throw new ArgumentOutOfRangeException ("value", "Only valid enumeration members are allowed");
\r
65 ViewState["HorizontalAlign"] = value;
\r
69 [DefaultValue (true), Bindable (true), WebCategory ("Layout")]
70 [WebSysDescription ("Determines if the content wraps at line-end.")]
\r
71 public virtual bool Wrap
\r
75 object o = ViewState["Wrap"];
\r
82 ViewState["Wrap"] = value;
\r
86 protected override void AddAttributesToRender(HtmlTextWriter writer)
\r
88 base.AddAttributesToRender(writer);
\r
89 if(BackImageUrl.Length > 0)
\r
91 writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundImage, "url(" + ResolveUrl(BackImageUrl) + ")");
\r
93 if(HorizontalAlign != HorizontalAlign.NotSet)
\r
95 writer.AddAttribute(HtmlTextWriterAttribute.Align, TypeDescriptor.GetConverter(typeof(HorizontalAlign)).ConvertToString(HorizontalAlign));
\r
99 writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "nowrap");
\r