Beispiel #1
0
 protected void studentDataGrid_CommandButtonInitialize(object sender, DevExpress.Web.ASPxGridViewCommandButtonEventArgs e)
 {
     if (Request.QueryString["UserRole"].ToString() != "admin")
     {
         e.Enabled = false;
         e.Column.ShowEditButton   = false;
         e.Column.ShowDeleteButton = false;
     }
 }
        protected void ASPxGridView1_CommandButtonInitialize(object sender, DevExpress.Web.ASPxGridViewCommandButtonEventArgs e)
        {
            bool isOddRow = e.VisibleIndex % 2 == 0;

            if (isOddRow)    // some condition
            // hide the Edit button
            {
                if (e.ButtonType == DevExpress.Web.ColumnCommandButtonType.Edit)
                {
                    e.Visible = false;
                }

                // disable the selction checkbox
                if (e.ButtonType == DevExpress.Web.ColumnCommandButtonType.SelectCheckbox)
                {
                    e.Enabled = false;
                }
            }
        }
Beispiel #3
0
        protected void gvPayments_CommandButtonInitialize(object sender, DevExpress.Web.ASPxGridViewCommandButtonEventArgs e)
        {
            string perms = (new PermissionService().GetPermissionsActivity(new SessionManager().GetUserId(this.Session), "smPaymentList"));

            if (e.ButtonType == DevExpress.Web.ColumnCommandButtonType.Edit)
            {
                if (perms.Contains("EDIT"))
                {
                    e.Enabled = true;
                }
                else
                {
                    e.Enabled = false;
                }
            }
            if (e.ButtonType == DevExpress.Web.ColumnCommandButtonType.Delete)
            {
                if (perms.Contains("DELETE"))
                {
                    e.Visible = true;
                }
                else
                {
                    e.Enabled = false;
                }
            }
            if (e.ButtonType == DevExpress.Web.ColumnCommandButtonType.Select)
            {
                if (perms.Contains("VIEW"))
                {
                    e.Visible = true;
                }
                else
                {
                    e.Enabled = false;
                }
            }
        }