문제

일부 사용자가 읽을 수 있고 다른 사용자가 액세스 할 수 있도록 ASPXGRIDVIEW를 가지고 있습니다. 이상적으로 이것은 Active Directory 그룹을 기반으로합니다.
어떻게 할 수 있습니까?

도움이 되었습니까?

해결책 2

데이터 바운드 이벤트 용 이벤트 핸들러를 만들고 다음과 같이 명령 열을 비활성화했습니다.

protected void ASPxGridView1_DataBound(object sender, EventArgs e)
{ 
  if (!User.IsInRole(ConfigurationSettings.AppSettings["EditActiveDirectoryGroup"]))
  {
    foreach (GridViewColumn c in ASPxGridView1.Columns)
    {
      if (c.GetType() == typeof(GridViewCommandColumn))
      {
        c.Visible = false;
      }
    }
  }
}

다른 팁

행의 행 편집을 사용하는 경우 사용자가 그리드를 편집 할 수있는 컨트롤을 숨기는 문제가됩니다.

이벤트 핸들러와 함께 GridView의 RowDatabound 이벤트에 연결하고 사용자의 역할을 확인하여이를 수행 할 수 있습니다. 수표에 실패하면 편집 컨트롤을 숨 깁니다.

void CustomersGridView_RowDataBound(Object sender, GridViewRowEventArgs e)
  {
    if(e.Row.RowType == DataControlRowType.DataRow)
    {
      if (!Roles.IsUserInRole("Admin"))
      {
        // Hide the edit controls.
        // This would be your "Edit" button or something.
        e.Row.Cells[1].Controls[0].Visible = false;  
      }
    }
  }

당신이 활성화하려면 EditButton 조건부로 특정 행에 대해서만 예시가 있습니다. CQ66919 devexpress.com에서.

또한 그들은 예를 나타냅니다 E366 최신 버전의 ASPxGridView.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top