private void hfCustomerActionId_DataBinding(Object sender, EventArgs e) { HiddenField hf = (HiddenField)sender; GridViewRow row = (GridViewRow)hf.NamingContainer; CustomerActionACLMappingHelperClass map1 = (CustomerActionACLMappingHelperClass)row.DataItem; hf.Value = map1.CustomerActionId.ToString(); }
protected void BindGrid() { var actions = ACLManager.GetAllCustomerActions(); if (actions.Count == 0) { lblMessage.Text = GetLocaleResourceString("Admin.ACL.NoActionDefined"); return; } var roles = CustomerManager.GetAllCustomerRoles(); if (roles.Count == 0) { lblMessage.Text = GetLocaleResourceString("Admin.ACL.NoRolesDefined"); return; } List <CustomerActionACLMappingHelperClass> dt = new List <CustomerActionACLMappingHelperClass>(); foreach (CustomerAction ca in actions) { CustomerActionACLMappingHelperClass map1 = new CustomerActionACLMappingHelperClass(); map1.CustomerActionId = ca.CustomerActionId; map1.CustomerActionName = ca.Name; map1.Allow = new Dictionary <int, bool>(); foreach (CustomerRole cr in roles) { var acls = ACLManager.GetAllAcl(ca.CustomerActionId, cr.CustomerRoleId, null); if (acls.Count > 0) { ACL acl = acls[0]; map1.Allow.Add(cr.CustomerRoleId, acl.Allow); } else { map1.Allow.Add(cr.CustomerRoleId, false); } } dt.Add(map1); } gvACL.DataSource = dt; gvACL.DataBind(); }
protected void BindGrid() { var actions = this.ACLService.GetAllCustomerActions(); if (actions.Count == 0) { lblMessage.Text = GetLocaleResourceString("Admin.ACL.NoActionDefined"); return; } var roles = this.CustomerService.GetAllCustomerRoles(); if (roles.Count == 0) { lblMessage.Text = GetLocaleResourceString("Admin.ACL.NoRolesDefined"); return; } List<CustomerActionACLMappingHelperClass> dt = new List<CustomerActionACLMappingHelperClass>(); foreach (CustomerAction ca in actions) { CustomerActionACLMappingHelperClass map1 = new CustomerActionACLMappingHelperClass(); map1.CustomerActionId = ca.CustomerActionId; map1.CustomerActionName = ca.Name; map1.Allow = new Dictionary<int, bool>(); foreach (CustomerRole cr in roles) { var acls = this.ACLService.GetAllAcl(ca.CustomerActionId, cr.CustomerRoleId, null); if (acls.Count > 0) { ACL acl = acls[0]; map1.Allow.Add(cr.CustomerRoleId, acl.Allow); } else { map1.Allow.Add(cr.CustomerRoleId, false); } } dt.Add(map1); } gvACL.DataSource = dt; gvACL.DataBind(); }
private void ctrl_DataBinding(Object sender, EventArgs e) { WebControl ctrl = (WebControl)sender; GridViewRow row = (GridViewRow)ctrl.NamingContainer; switch (dataType) { case "String": { object RawValue = DataBinder.Eval(row.DataItem, columnName); ((Label)ctrl).Text = RawValue.ToString(); } break; case "Checkbox": { CustomerActionACLMappingHelperClass map1 = (CustomerActionACLMappingHelperClass)row.DataItem; ((CheckBox)ctrl).Checked = map1.Allow[this.customerRoleId]; } break; } }