사용자 목록을 표시하는 양식을 만들었습니다. 목록의 항목을 클릭하면 소속 속성을 컨트롤러로 전달해야합니다. 이를 위해, 나는 다음과 같은 ActionLink 추가 한 : 나는 데이터를 볼 수 corrctly 전달되었는지 여부를 확인하신 후개체의 목록을 컨트롤러에 전달하는 방법은 무엇입니까?
@Html.ActionLink(@item.Username.ToString(), "UserEdit", "Admin", new DemoRes.Models.User{ UserId = item.UserId, Email= item.Email, Username=item.Username, Password=item.Password, IsActive=item.IsActive, Ownership=item.Ownership}, null)
를하고 확인을 보인다
다음item.Ownership
Count = 1
[0]: 18878
item.Ownership.GetType()
{Name = "List`1" FullName = "System.Collections.Generic.List`1[[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"}
, 객체가 전달 될 때 컨트롤러에서 다음 UserEdit 방법으로, 모든 속성이 올바르게 설정되어 있지만 소유권 목록이 비어 있습니다 :
public ActionResult UserEdit(DemoRes.Models.User user)
{
//here user.Ownership is empty
}
을하고이 사용자 클래스 :
누구나보기에서 컨트롤러로 다시 전달하기 위해 모든 클래스 속성 (목록과 같은 기본 유형 및 복합 유형)을 올바르게 바인딩하는 올바른 방법을 알고 있습니까?
GET 요청 쿼리 문자열을 처리하는 메서드에서'string.Join (",", item.Ownership)'을 실행 한 다음 commma로 구분 된 소유권 'long' 값 목록을 처리하는 방법은 무엇입니까? –