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)); }
/// <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<TModel></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(), "")); }
/// <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<TModel></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))); }
/// <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<TModel></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, "")); }
/// <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<TModel></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)); }
public HtmlHelper(IWebFormsView <TModel> wfv) { Initialize(wfv.Model, new WFModelMetaData()); }