jeudi 19 mai 2016

How to Enable HtmlHelper.ClientValidationEnabled for Partial View Only

i need to know, is it possible to enable client side validation for specific Partial View only? I've tried placing the code as below in my partial view, but it still validate my parent view. any ideas?

Thanks

--sample of my parent view----

@using (Html.BeginForm("Create", "FinishProductCompleteForm", FormMethod.Post, new { enctype = "multipart/form-data" }))

{

 @Html.AntiForgeryToken()

 @Html.Partial("_FPdetails")

 @Html.Partial("_RawMaterialTable")

 @Html.Partial("_CreateNewRawMaterial")   

}

--partial view (_CreateNewRawMaterial)--

@model MyCOOEntity.CostAnalysisModel.FinishProductCompleteForm

@{    
    HtmlHelper.ClientValidationEnabled = true;
}

<div>
--codes-
</div>

Aucun commentaire:

Enregistrer un commentaire