diff options
author | Igor Zelmanovich <igorz@mono-cvs.ximian.com> | 2008-01-07 17:24:43 +0300 |
---|---|---|
committer | Igor Zelmanovich <igorz@mono-cvs.ximian.com> | 2008-01-07 17:24:43 +0300 |
commit | 26024a3c367e75bc916faca534ab356279eda953 (patch) | |
tree | fc8d91fb5796ec3ffb494c396eb5574cd797afd9 /mcs/class/System.Web/System.Web.UI/Page.cs | |
parent | 0c6081520706d263235c7bddaea5383ccd61d739 (diff) |
2008-01-07 Igor Zelmanovich <igorz@mainsoft.com>
* Page.cs: added internal API
* IScriptManager.cs: added new internal interface.
2007-01-07 Igor Zelmanovich <igorz@mainsoft.com>
* BaseCompareValidator.cs:
* BaseValidator.cs:
* CompareValidator.cs:
* CustomValidator.cs:
* RangeValidator.cs:
* RegularExpressionValidator.cs:
* RequiredFieldValidator.cs:
refactoring: If page contents instance of IScriptManager, validators call
it's API instead Page.ClientScript.
svn path=/trunk/mcs/; revision=92389
Diffstat (limited to 'mcs/class/System.Web/System.Web.UI/Page.cs')
-rw-r--r-- | mcs/class/System.Web/System.Web.UI/Page.cs | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/mcs/class/System.Web/System.Web.UI/Page.cs b/mcs/class/System.Web/System.Web.UI/Page.cs index ab8e6446049..6404b0c4573 100644 --- a/mcs/class/System.Web/System.Web.UI/Page.cs +++ b/mcs/class/System.Web/System.Web.UI/Page.cs @@ -448,6 +448,59 @@ public partial class Page : TemplateControl, IHttpHandler return (PageAdapter)Adapter; } } + + string _validationStartupScript; + string _validationOnSubmitStatement; + string _validationInitializeScript; + string _webFormScriptReference; + + internal string WebFormScriptReference { + get { + if (_webFormScriptReference == null) + _webFormScriptReference = IsMultiForm ? theForm : "window"; + return _webFormScriptReference; + } + } + + internal string ValidationStartupScript { + get { + if (_validationStartupScript == null) { + _validationStartupScript = +@" +" + WebFormScriptReference + @".Page_ValidationActive = false; +" + WebFormScriptReference + @".ValidatorOnLoad(); +" + WebFormScriptReference + @".ValidatorOnSubmit = function () { + if (this.Page_ValidationActive) { + return this.ValidatorCommonOnSubmit(); + } + return true; +}; +"; + } + return _validationStartupScript; + } + } + + internal string ValidationOnSubmitStatement { + get { + if (_validationOnSubmitStatement == null) + _validationOnSubmitStatement = "if (!" + WebFormScriptReference + ".ValidatorOnSubmit()) return false;"; + return _validationOnSubmitStatement; + } + } + + internal string ValidationInitializeScript { + get { + if (_validationInitializeScript == null) + _validationInitializeScript = "WebFormValidation_Initialize(" + WebFormScriptReference + ");"; + return _validationInitializeScript; + } + } + + internal IScriptManager ScriptManager { + get { return (IScriptManager) Items [typeof (IScriptManager)]; } + } + #endif #if !TARGET_J2EE |