private void lit_OnDataBinding(object sender, EventArgs e) { DataGridItem objContainer = (DataGridItem)lbl.NamingContainer; DataRowView row = objContainer.DataItem as DataRowView; // 04/25/2006 Paul. We don't have access to the ACLGrid in InstantiateIn(), so do so here. ACLGrid grd = objContainer.Parent.Parent as ACLGrid; if (!grd.EnableACLEditing) { divList.Controls.Clear(); // 04/25/2006 Paul. I'd like to remove the dvList, but I can't do it here. //divList.Parent.Controls.Remove(divList); //divList = null; } if (row != null) { string sMODULE_NAME = Sql.ToString(row["MODULE_NAME"]); // 04/25/2006 Paul. We could use GUIDS like SugarCRM, but since there is only one ACL grid, // there is no need for that kind of uniqueness. divLabel.ID = sMODULE_NAME + "_" + sACCESS_TYPE + "link"; hid.ID = "hid" + sMODULE_NAME + "_" + sACCESS_TYPE; if (row[sDATA_FIELD] != DBNull.Value) { // 04/30/2006 Paul. Use the Context to store pointers to the localization objects. // This is so that we don't need to require that the page inherits from SplendidPage. L10N L10n = HttpContext.Current.Items["L10n"] as L10N; if (L10n == null) { // 04/26/2006 Paul. We want to have the AccessView on the SystemCheck page. L10n = new L10N(Sql.ToString(HttpContext.Current.Session["USER_SETTINGS/CULTURE"])); } int nACCESS = Sql.ToInteger(row[sDATA_FIELD]); divLabel.Attributes.Add("class", AccessClassName(sACCESS_TYPE, nACCESS)); // 04/25/2006 Paul. Don't update values on postback, otherwise it will over-write modified values. // 04/26/2006 Paul. Make sure to set the division color, even on postback. // 05/03/2006 Paul. If we are not editing, then always bind to the query. // This is so that the AccessView control can be placed in an unrelated control that have postbacks. // This was first noticed in the UserRolesView.ascx. if (!objContainer.Page.IsPostBack || !grd.EnableACLEditing) { lbl.Text = L10n.Term(AccessLabel(sACCESS_TYPE, nACCESS)); hid.Value = lbl.Text; } else { // 04/25/2006 Paul. The label will not retain its value, so restore from the hidden field. // We use the hidden field because the value my have been changed by the user. // 04/25/2006 Paul. We are too early in the ASP.NET lifecycle to access hid.Value, // so go directly to the Request to get the submitted value. lbl.Text = hid.Page.Request[hid.UniqueID]; } } } }