Exemple #1
0
        public static bool TryValidateModel <TModel>(IWebFormsView <TModel> wfView, XmlDataAnnotationsRuleSet ruleSet)
        {
            List <string>   errors       = new List <string>();
            IWFRuleProvider ruleProvider = new WFXmlRuleSetRuleProvider(ruleSet);

            return(WFUtilities.TryValidateModel(wfView.Model, "", new WFHttpContextValueProvider(HttpContext.Current), wfView.Html.MetaData, ruleProvider));
        }
Exemple #2
0
 /// <summary>
 /// Validate the model against form values (not against itself).<br/>
 /// Use WFUtilities.TryValidateModel() to validate against targets other than the current HttpRequest.
 /// </summary>
 /// <typeparam name="TModel">The type of the model object to be validated.</typeparam>
 /// <param name="wfView">The page or usercontrol implementing IWebFormsView&lt;TModel&gt;</param>
 /// <returns>Returns 'true' if the values in the form data validate successfully.</returns>
 public static bool TryValidateModel <TModel>(IWebFormsView <TModel> wfView)
 {
     return(TryValidateModel(wfView, wfView.Model.GetType(), ""));
 }
Exemple #3
0
        /// <summary>
        /// Validate the model against form values (not against itself).<br/>
        /// Use WFUtilities.TryValidateModel() to validate against targets other than the current HttpRequest.
        /// </summary>
        /// <typeparam name="TModel">The type of the model object to be validated.</typeparam>
        /// <param name="wfView">The page or usercontrol implementing IWebFormsView&lt;TModel&gt;</param>
        /// <param name="proxyClass">Optional. Validation can use this class to validate against, instead of the model class.</param>
        /// <param name="prefix">Optional. The prefix to separate different objects in form data.<br/>
        /// ie: object1_FirstName=John, object2_FirstName=Joe</param>
        /// <returns>Returns 'true' if the values in the form data validate successfully.</returns>
        public static bool TryValidateModel <TModel>(IWebFormsView <TModel> wfView, Type proxyClass, string prefix)
        {
            List <string> errors = new List <string>();

            return(WFUtilities.TryValidateModel(wfView.Model, prefix, new WFHttpContextValueProvider(HttpContext.Current), wfView.Html.MetaData, new WFTypeRuleProvider(proxyClass)));
        }
Exemple #4
0
 /// <summary>
 /// Validate the model against form values (not against itself).<br/>
 /// Use WFUtilities.TryValidateModel() to validate against targets other than the current HttpRequest.
 /// </summary>
 /// <typeparam name="TModel">The type of the model object to be validated.</typeparam>
 /// <param name="wfView">The page or usercontrol implementing IWebFormsView&lt;TModel&gt;</param>
 /// <param name="proxyClass">Optional. Validation can use this class to validate against, instead of the model class.</param>
 /// <returns>Returns 'true' if the values in the form data validate successfully.</returns>
 public static bool TryValidateModel <TModel>(IWebFormsView <TModel> wfView, Type proxyClass)
 {
     return(TryValidateModel(wfView, proxyClass, ""));
 }
Exemple #5
0
 /// <summary>
 /// Validate the model against form values (not against itself).<br/>
 /// Use WFUtilities.TryValidateModel() to validate against targets other than the current HttpRequest.
 /// </summary>
 /// <typeparam name="TModel">The type of the model object to be validated.</typeparam>
 /// <param name="wfView">The page or usercontrol implementing IWebFormsView&lt;TModel&gt;</param>
 /// <param name="prefix">Optional. The prefix to separate different objects in form data.<br/>
 /// ie: object1_FirstName=John, object2_FirstName=Joe</param>
 /// <returns>Returns 'true' if the values in the form data validate successfully.</returns>
 public static bool TryValidateModel <TModel>(IWebFormsView <TModel> wfView, string prefix)
 {
     return(TryValidateModel(wfView, null, prefix));
 }
Exemple #6
0
 public HtmlHelper(IWebFormsView <TModel> wfv)
 {
     Initialize(wfv.Model, new WFModelMetaData());
 }