1

I have a grid of user info in ASP.NET Mvc 2. When i click on a user, i open a jQuery Modal dialog, which enables to edit the user.I am able to edit and save the user.

Can some one help me on how to do validation on this modal dialog using the asp.net mvc data annotaions on server side and display the validation message.

1
  • here a neat article for that... Commented Sep 26, 2012 at 11:55

1 Answer 1

2

Use this function to load all modal dialogue popups

function ShowPopup(popupID, pageUrl) {

            $("#" + popupID).empty();

            $("#" + popupID).dialog({
                autoOpen: false,
                modal: true,
                resizable: false,
                height: 'auto',

                width: 565 //set width of pop up
            });

            $("#" + popupID).html(popUpLoaderHtml);

            $.ajax({

                type: 'GET',
                url: pageUrl,
                cache: false,
                success: function (data) {
                    $("#" + popupID).empty();
                    $("#" + popupID).append(data);




                }
            });

            $("#" + popupID).dialog("open");

        }

Customise this method for any modal dialogue like this

function ShowCommentEditPopUp(popupID, CommentId) {


        ShowPopup(popupID, '/comments/edit/' + CommentId);
    }

Here the 'popupID' is the ID of the div where popup is loaded

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.