2013-06-05 56 views
0

我需要在我的视图中调用RenderPartial,局部视图必须以弹出形式打开。RenderPartial with Popup-MVC3

任何建议如何做到这一点?

+0

你可以有一个空的布局,并使用常规弹出。或者你可以有一些奇特的jQuery对话框并使用ajax加载它。 –

+0

感谢您的回答,那么我一定有兴趣知道如何通过MVC视图来调用它。 –

回答

1

我做这个使用JavaScript/jQuery的

方法来设置你的对话框(这个在页面加载)

function setupAddFeeDialog() { 
    jQuery("#dlgCreateFee").dialog({ 
     autoOpen: false, 
     modal: true, 
     width: 650, 
     buttons: { 
      "Save": function() { 
       //Insert logic for the save button 

      }, 
      "Cancel": function() { 
       jQuery(this).dialog("close"); 
      } 

     } 
    }); 
} 

方法,当你想打开对话框拨打:

function addFee() { 
    $.ajax({ 
     url: [Insert your URL where retrieving solution], 
     type: 'POST', 
     data: { "myId": [Variable with your ID] } //Or any other parameters you need to pass to the controller 
    }).done(function (data) { 
     jQuery("#divCreateFee").html(data); 
     jQuery("#dlgCreateFee").dialog("open"); 
    }); 
}