mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-19 01:31:17 -10:00
Adding reference source for System.Data System.Data.DataSetExtensions System.Data.Entity System.Data.Entity.Design System.Data.Linq System.Data.SqlXml System.ServiceModel System.ServiceModel.Activation System.ServiceModel.Activities System.ServiceModel.Channels System.ServiceModel.Discovery System.ServiceModel.Internals System.ServiceModel.Routing System.ServiceModel.WasHosting System.ServiceModel.Web System.Web System.Web.ApplicationServices System.Web.DynamicData System.Web.Entity System.Web.Entity.Design System.Web.Extensions System.Web.Mobile System.Web.Routing System.Web.Services System.Xml System.Xml.Linq
96 lines
3.2 KiB
C#
96 lines
3.2 KiB
C#
//------------------------------------------------------------------------------
|
|
// <copyright file="WmlValidationSummaryAdapter.cs" company="Microsoft">
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// </copyright>
|
|
//------------------------------------------------------------------------------
|
|
|
|
#if WMLSUPPORT
|
|
|
|
namespace System.Web.UI.WebControls.Adapters {
|
|
using System.Collections;
|
|
using System.Web.UI.WebControls;
|
|
using System.Web.Util;
|
|
|
|
public class WmlValidationSummaryAdapter : ValidationSummaryAdapter {
|
|
|
|
private BulletedList bulletedList;
|
|
private bool singleParagraph = false;
|
|
|
|
protected internal override void OnInit(EventArgs e) {
|
|
bulletedList = new BulletedList();
|
|
Control.Controls.Add(bulletedList);
|
|
}
|
|
|
|
protected internal override void Render(HtmlTextWriter markupWriter) {
|
|
WmlTextWriter writer = (WmlTextWriter)markupWriter;
|
|
String[] errorMessages = null;
|
|
bool inError = false;
|
|
bool enteredStyle = false;
|
|
|
|
if (!Control.Enabled || !Control.Visible || !Control.ShowSummary) {
|
|
return;
|
|
}
|
|
|
|
errorMessages = Control.GetErrorMessages(out inError);
|
|
if (!inError) {
|
|
return;
|
|
}
|
|
|
|
if (Control.DisplayMode == ValidationSummaryDisplayMode.SingleParagraph) {
|
|
singleParagraph = true;
|
|
}
|
|
|
|
if (Control.HeaderText.Length > 0) {
|
|
writer.EnterStyle(Control.ControlStyle);
|
|
enteredStyle = true;
|
|
writer.WriteEncodedText(Control.HeaderText);
|
|
WriteSeparator(writer);
|
|
}
|
|
|
|
if (!String.IsNullOrEmpty(errorMessages)) {
|
|
if (!enteredStyle) {
|
|
writer.EnterStyle(Control.ControlStyle);
|
|
enteredStyle = true;
|
|
}
|
|
|
|
if (singleParagraph) {
|
|
foreach (String errorMessage in errorMessages) {
|
|
Debug.Assert(errorMessage != null && errorMessage.Length > 0, "Bad Error Messages");
|
|
writer.WriteEncodedText(errorMessage);
|
|
WriteSeparator(writer);
|
|
}
|
|
writer.WriteBreak();
|
|
}
|
|
else {
|
|
ArrayList arr = new ArrayList();
|
|
foreach (String errorMessage in errorMessages) {
|
|
Debug.Assert(errorMessage != null && errorMessage.Length > 0, "Bad Error Messages");
|
|
arr.Add(errorMessage);
|
|
}
|
|
|
|
bulletedList.DisplayMode = BulletedListDisplayMode.Text;
|
|
bulletedList.DataSource = arr;
|
|
bulletedList.DataBind();
|
|
|
|
RenderChildren(writer);
|
|
}
|
|
}
|
|
|
|
if (enteredStyle) {
|
|
writer.ExitStyle(Control.ControlStyle);
|
|
}
|
|
}
|
|
|
|
private void WriteSeparator(HtmlTextWriter writer) {
|
|
if (singleParagraph) {
|
|
writer.Write(" ");
|
|
}
|
|
else {
|
|
writer.WriteBreak();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif
|