Tuesday, November 7, 2017

Unobtrusive validation - Partial View



=======================================================


function ChangePassword() {
    var url = ServerUrl + '/User/ChangePassword';
    $.get(url, null, function (html) {
        $('#div_User_details').html(html);
        $.validator.unobtrusive.parse($("#div_User_details"));
        $('#div_User_details').dialog({
            modal: true,
            title: "Change Password",
            width: 400,

            buttons: [
                        {

                            text: "Done",
                            'class': "btnSaveUser",
                            click: function () {

                                Isuccess = SaveChangePassword();

                            }
                        },
                        {
                            text: "Cancel",


                            click: function () {
                                var DialogId = "#" + $('.ui-dialog').attr('aria-describedby');

                                $("#div_User_details").dialog('close');

                            }
                        }
            ],
            close: function (event, ui) {
                $(this).html("");
                $('#div_User_details').empty();

            }
        });
    });
};
==================================================

 [CustomAuthorize]
        public PartialViewResult ChangePassword()
        {
            ChangePassword cp = new ChangePassword();
            cp.UserId = CurrentUser.UserId;
            ViewBag.visible = true;
            return PartialView("_ChangePassword", cp);
        }

No comments:

Post a Comment

javascript Filter/index off

 var family = [{"name":"Jack",  "age": 26},               {"name":"Jill",  "age"...