2011-01-24 4 views

답변

1
Roles.GetRolesForUser(user) 

http://msdn.microsoft.com/en-us/library/8h930x07.aspx

UPDATE

이것은 당신이 사용자

GridView.RowDataBound += new GridViewRowEventHandler(GridView_RowDataBound); 

void GridView_RowDataBound(object sender, GridViewRowEventArgs e) { 
    GridView gridview = (GridView)sender; 
    if (e.Row.RowType == DataControlRowType.DataRow) { 
     string username = DataBinder.Eval(e.Row.DataItem, "yourusernamecolumn").ToString(); 
     Literal c = new Literal(); 
     c.Text = Roles.GetRolesForUser(username).ToString(); //decide how you want to display the list 
     e.Row.Cells[somecolumnindex].Controls.Add(c); 
    } 
} 

당신의 역할에서 바로 읽을 더 좋을 수도 많은 경우 매우 느린 될 것입니다 - 회원 테이블.

+0

하지만 역할 정보를 사용자의 다른 정보와 결합하여 데이터 그 림뷰에 바인딩하는 방법은 무엇입니까? –

관련 문제