mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 11:21:39 -10:00
* RequiredFieldValidator.cs: Added all attributes * Style.cs: Added all attributes * Table.cs: Added all attributes * TableCell.cs: Added all attributes, added error checks, throws more exceptions * TableCellCollection.cs: Added attribute * TableRow.cs: Added all attributes * TableRowCollection: Added attribute * TableStyle.cs: Added all attributes, improved error messages * TemplateColumn.cs: Added all attributes * TextBox.cs: Added all attributes, added error checks, throws more exceptions * ValidationSummary.cs: Added all attributes * WebControl.cs: Added all attributes * Xml.cs: Added all attributes svn path=/trunk/mcs/; revision=16907
65 lines
1.5 KiB
C#
65 lines
1.5 KiB
C#
/**
|
|
* Namespace: System.Web.UI.WebControls
|
|
* Class: RequiredFieldValidator
|
|
*
|
|
* Author: Gaurav Vaish
|
|
* Maintainer: [email protected]
|
|
* Contact: <[email protected]>, <[email protected]>
|
|
* Implementation: yes
|
|
* Status: 100%
|
|
*
|
|
* (C) Gaurav Vaish (2002)
|
|
*/
|
|
|
|
using System.ComponentModel;
|
|
|
|
namespace System.Web.UI.WebControls
|
|
{
|
|
[ToolboxData("<{0}:RequiredFieldValidator runat=\"server\" "
|
|
+ "ErrorMessage=\"RequiredFieldValidator\">"
|
|
+ "</{0}:RequiredFieldValidator>")]
|
|
public class RequiredFieldValidator : BaseValidator
|
|
{
|
|
public RequiredFieldValidator(): base()
|
|
{
|
|
}
|
|
|
|
[DefaultValue (""), Bindable (true), WebCategory ("Behavior")]
|
|
[WebSysDescription ("The initial value for the required field.")]
|
|
public string InitialValue
|
|
{
|
|
get
|
|
{
|
|
object o = ViewState["InitialValue"];
|
|
if(o != null)
|
|
return (String)o;
|
|
return String.Empty;
|
|
}
|
|
set
|
|
{
|
|
ViewState["InitialValue"] = value;
|
|
}
|
|
}
|
|
|
|
protected override void AddAttributesToRender(HtmlTextWriter writer)
|
|
{
|
|
base.AddAttributesToRender(writer);
|
|
if(RenderUplevel)
|
|
{
|
|
writer.AddAttribute("evaluationfunction", "RequiredFieldValidatorEvaluateIsValid");
|
|
writer.AddAttribute("initialvalue", InitialValue);
|
|
}
|
|
}
|
|
|
|
protected override bool EvaluateIsValid()
|
|
{
|
|
string val = GetControlValidationValue(ControlToValidate);
|
|
if(val != null)
|
|
{
|
|
return (val.Trim() != InitialValue.Trim());
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
}
|