2011-08-28 57 views
2

如何禁用通常的_Layout.cshtml为一个视图。asp.net mvc3禁用视图的masterpage

我尝试使用aboutuser.cshtml视图的内容来使用ajax填充div。你认为这是一个正确的方案吗?

$('#SelectUser').click(function() { 

      $('#userPlace').html('<strong>Loading...</strong>'); 
      $.post('InfoFor?userSelect=' + ($('#usersoption:selected').val()), function (data) { 
       $('#userPlace').html(data); 
      }); 
     }); 

回答

4
内部

此视图/部分:

@{ 
    Layout = null; 
} 

或从控制器动作服务它返回一个的PartialView代替View

public ActionResult Foo() 
{ 
    return PartialView(); 
}