Click here to Skip to main content
15,887,776 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

Can anyone please let me know how can I have a modal window at my every server call in mvc 3.0

I know I need to use jquery modal window, I am able to use when I need to load a partial view, but not able to use the same, when a complete new needs to be rendered.

Please help!!!

Thanks in advance
Posted

1 solution

JavaScript
//Javascript code
function showMessageDetails() {
   
    $.ajax({
        url: '/Position/SelectedOption/',
        type: 'POST',
        data: { id: inputTextValue},
        success: function (result) {

            $.post("/Position/SelectedOption/" + inputTextValue, function (data) {
                        $('<div>' + data + '</div>').load(this.href).dialog({ show: { effect: "FadeIn", duration: 600} }, { modal: true });
            });
        },
        error: function () {
            //some code if failed
            alert("fail");
        }
    });



//Control code
SQL
public ActionResult SelectedOption(string id)
{
    ModelClass ModelObject = new ModelClass();
    return View("this.pagetoredirect", ModelObject);
}


inputTextValue = Pass your input value here
this.pagetoredirect = Give your View page name here

From the above code you can view the View page as Modal View.
 
Share this answer
 
Comments
ankurtrue1 17-Apr-12 8:04am    
Hi Dhanamanikandan,

But will this help, in posting all my data which would needs to be transferred from my current page to next page?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900