Hi Users,
I am using jquery to do enable/disable operation.
<script type="text/javascript">
$(document).ready(function() {
$("#ddlUser").change(function() {
var selectedValue = $(this)[0].value;
if (selectedValue == "--Select User--") {
$("#txtUserName").removeAttr("disabled");
$("#txtUserName").val("");
$("#txtPassword").removeAttr("disabled");
$("#txtPassword").val("");
$("#txtConfirmPassword").removeAttr("disabled");
$("#txtConfirmPassword").val("");
$("#txtEmailId").removeAttr("disabled");
$("#txtEmailId").val("");
}
else {
$("#txtUserName").attr("disabled", "disabled");
$("#txtPassword").attr("disabled", "disabled");
$("#txtConfirmPassword").attr("disabled", "disabled");
$("#txtEmailId").attr("disabled", "disabled");
}
});
});
</script>
<%= Html.DropDownList("ddlUsers", (SelectList)ViewData["ddlUsers"], "--Select User--", new { id = "ddlUsers", title = "Select User" })%>
Controller data passed as
MembershipUserCollection lstUser = Membership.GetAllUsers();
ViewData["ddlUsers"] = new SelectList(lstUser, "UserName", "UserName");