2014-01-06 8 views

답변

1

당신은 ChildActionOnly를 사용할 필요

보기에서 다음
[ChildActionOnly] 
public ActionResult action1() 
{ 
    // 
    return PartialView(); 
} 

:

@Html.Partial("action1") 

하지만 당신은 간단하게, 헬퍼 클래스와 같은 메소드를 호출 할 경우 당신은 이렇게 할 수 있습니다 :

@helper ShowTree() 
{ 
    //some code 
} 
0

시도해보십시오.

다음은 통화 컨트롤러 동작 이벤트를 보는 방법에 대한 모든 형식입니다.

-> Beginform

 @using (Html.BeginForm("VendorContactDetail", "VendorAccount", FormMethod.Post, new { id = "frmVendorContact" })) 
       {} 
[AllowAnonymous] 
     public ActionResult VendorContactDetail() 
     {} 

전화 - ->

@using (Ajax.BeginForm("ContainerSizeDetail", "Content", FormMethod.Post, null, new { @class = "" })) 
     {} 
[HttpPost] 
     public ActionResult ContainerSizeDetail(ContainerSizeModel model) 
     {} 

을 아약스 beginform와 전화> Ajax 호출에 전화

 var request = $.ajax({ 
         url: "http://localhost/ProjectDirectory/VendorAccount/ValidateUser", 
         type: 'POST', 
         cache: false, 
         data: JSON.stringify(returnValue), 
         dataType: 'json', 
         contentType: 'application/json; charset=utf-8' 
        }); 

[AllowAnonymous] 
     [HttpPost] 
     public ActionResult ValidateUser(VendorRegistrationModel model) 
     {} 
관련 문제