2 // System.Web.UI.WebControls.ValidationSummary.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;
\r
14 using System.Drawing;
\r
16 using System.Web.UI;
\r
18 namespace System.Web.UI.WebControls
\r
20 public class ValidationSummary : WebControl
\r
22 private bool uplevelRender;
\r
24 public ValidationSummary(): base(HtmlTextWriterTag.Div)
\r
26 uplevelRender = false;
\r
27 ForeColor = Color.Red;
\r
30 [DefaultValue (typeof (ValidationSummaryDisplayMode), "BulletList"), Bindable (true), WebCategory ("Appearance")]
31 [WebSysDescription ("The type of how validation summaries should be displayed.")]
\r
32 public ValidationSummaryDisplayMode DisplayMode
\r
36 object o = ViewState["DisplayMode"];
\r
38 return (ValidationSummaryDisplayMode)o;
\r
39 return ValidationSummaryDisplayMode.BulletList;
\r
43 if(!Enum.IsDefined(typeof(ValidationSummaryDisplayMode), value))
\r
44 throw new ArgumentException();
\r
45 ViewState["DisplayMode"] = value;
\r
49 [DefaultValue (true), WebCategory ("Behavior")]
50 [WebSysDescription ("Determines if the validation summary should be updated directly on the client using script code.")]
\r
51 public bool EnableClientScript
\r
55 object o = ViewState["EnableClientScript"];
\r
62 ViewState["EnableClientScript"] = value;
\r
66 [DefaultValue (null)]
\r
67 public override Color ForeColor
\r
79 [DefaultValue (false), Bindable (true), WebCategory ("Behavior")]
80 [WebSysDescription ("Determines if the validation summary should display a message box on the client if an uplevel browser is used.")]
\r
81 public bool ShowMessageBox
\r
85 object o = ViewState["ShowMessageBox"];
\r
92 ViewState["ShowMessageBox"] = value;
\r
96 [DefaultValue (true), Bindable (true), WebCategory ("Behavior")]
97 [WebSysDescription ("Determines if the validation summary should display a summary.")]
\r
98 public bool ShowSummary
\r
102 object o = ViewState["ShowSummary"];
\r
109 ViewState["ShowSummary"] = value;
\r
113 [DefaultValue (""), Bindable (true), WebCategory ("Appearance")]
114 [WebSysDescription ("A text that is diplayed as a header for the validation report.")]
\r
115 public string HeaderText
\r
119 object o = ViewState["HeaderText"];
\r
122 return String.Empty;
\r
126 ViewState["HeaderText"] = value;
\r
130 [MonoTODO("FIXME_See_Comments")]
\r
131 protected override void AddAttributesToRender(HtmlTextWriter writer)
\r
133 AddAttributesToRender(writer);
\r
136 //FIXME: This is not the case always. I forgot the case when it is absent.
\r
137 // something to do with the ID's value? or ClienID's value itself?
\r
138 writer.AddAttribute("id", ClientID);
\r
139 if(HeaderText.Length > 0)
\r
140 writer.AddAttribute("headertext", HeaderText, true);
\r
142 writer.AddAttribute("showmessagebox", "True");
\r
144 writer.AddAttribute("showsummary", "False");
\r
145 if(DisplayMode != ValidationSummaryDisplayMode.BulletList)
\r
147 writer.AddAttribute("displaymode", PropertyConverter.EnumToString(typeof(ValidationSummaryDisplayMode), DisplayMode));
\r