0

I want to use modal popups for editing and inserting at view html but i couldn't be sure how to do this?

Is there any way to do this?

I don't want to create new html for insert form because there is only name field. Modal pop-up will suit perfectly i think.

Gaz Winter
  • 2,924
  • 2
  • 25
  • 47
bahadir arslan
  • 4,535
  • 7
  • 44
  • 82

1 Answers1

0

Create your html

<div id="demoDialog" title="Dialog Title">

    <!-- Content, form, etc. -->
    <form></form>
</div>

Initialize the dialog window

Reference: http://api.jqueryui.com/1.8/dialog/

// Dialog creation
$("#demoDialog").dialog({
    resizable: false,
    draggable: false,
    autoOpen: false,
    modal: true,
    open: function(){
        $(".ui-widget-overlay").hide().fadeTo(800, 0.8);
    }
});


// Open the dialog
$("#showDialog").click(function(){
    $("#demoDialog").dialog( "open" );
    return false;
});

You can use a partial view to load your html content. Have inside your dialog ID somehow to store the value returned from the modal window if you need to feed it to another form or processing.

Fus Ro Dah
  • 331
  • 5
  • 22