<script type="text/javascript">
$(document).ready(function() {
var disabled = <%=ViewData["disablecontrols"].ToString()%>;
if (disabled) {
$('input,select').attr('disabled',disabled);
}
})
</script>
<input type="text" name="patientName">
On clicking New button it directs to newdetail controller
In my controller :
public ActionResult NewOperation(string button)
{
PatientDemoVM patientpersonal = new PatientDemoVM();
if (button == "New")
{
ViewData["disablecontrols"] = false;
patientpersonal.PatientCode = null;
return View("PatDemo", patientpersonal);
}
return View();
}