So aktivieren/Deaktivieren Sie die textbox. und auch Textfeld leer ändern der Wert in der drop-down-Liste

Ich bin mit jquery zu tun, aktivieren/deaktivieren Bedienung.

<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 übergebenen Daten als

 MembershipUserCollection lstUser = Membership.GetAllUsers();

  ViewData["ddlUsers"] = new SelectList(lstUser, "UserName", "UserName");  

InformationsquelleAutor TSara | 2010-07-23

Schreibe einen Kommentar