2013-05-02 5 views
2

나는 당신이 가정은 "목록"보기합격 값이

cshtml 파일

@Html.RadioButtonFor(m => m.SmokeHouse, 1) 
@Html.RadioButtonFor(m => m.SmokeHouse, 0) 

@Html.RadioButtonFor(m => m.SmokeCar, 1) 
@Html.RadioButtonFor(m => m.SmokeCar, 0) 

@Html.RadioButtonFor(m => m.SmokeWork, 1)  
@Html.RadioButtonFor(m => m.SmokeWork, 0) 

[HttpPost] 
public ViewResult SmokingEnvironments() 
{ 
    return View("List"); 
} 

클래스

public class Screen 
{ 
    public int SmokeCar { get; set; } 
    public int SmokeHouse { get; set; } 
    public int SmokeWork { get; set; } 
} 

답변

1

이러한 Radioboxes에서 선택한 값을 전달 할 필요가 제출 버튼을 클릭하면 컨트롤러를 업데이트하여 모델을 매개 변수로 사용하여 다음보기로 전달합니다.

[HttpPost] 
public ViewResult SmokingEnvironments(Screen model) 
{ 
    return View("List", model); 
} 
+0

보기가 결과라는 다른 폴더에 있다면? – user2224493

+0

@ user2224493 그게 무슨 뜻입니까? – asawyer

+0

돌아 가기보기 ("~/Views/Results/List.aspx", model); – user2224493