saranya

saranya

  • NA
  • 9
  • 28.7k

disabling controls is not working in my view

Nov 28 2017 12:57 AM
In my view:
<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();
}
 

Answers (3)