protected void Page_Init(object sender, EventArgs e) { foreach (DataGridColumn column in grdPortals.Columns) { if (column.GetType() == typeof(ImageCommandColumn)) { //Manage Delete Confirm JS ImageCommandColumn imageColumn = (ImageCommandColumn)column; if (imageColumn.CommandName == "Delete") { imageColumn.OnClickJS = Localization.GetString("DeleteItem"); } //Manage Edit Column NavigateURLFormatString if (imageColumn.CommandName == "Edit") { //The Friendly URL parser does not like non-alphanumeric characters //so first create the format string with a dummy value and then //replace the dummy value with the FormatString place holder TabController objTabs = new TabController(); TabInfo objTab = objTabs.GetTabByName("Site Settings", PortalSettings.PortalId, PortalSettings.AdminTabId); string formatString = Globals.NavigateURL(objTab.TabID, "", "pid=KEYFIELD"); formatString = formatString.Replace("KEYFIELD", "{0}"); imageColumn.NavigateURLFormatString = formatString; } //Localize Image Column Text if (imageColumn.CommandName != "") { imageColumn.Text = Localization.GetString(imageColumn.CommandName, LocalResourceFile); } } } }
public ImageCommandColumn CreateCommandColumn() { var column = new ImageCommandColumn() { ID = "CustomImageCommands", Width = new Unit(Width), MenuDisabled = true, Align = Alignment.Center, Locked = Locked }; if (!string.IsNullOrEmpty(PrepareCommandFunction)) { column.PrepareCommand.Fn = PrepareCommandFunction; } if (!string.IsNullOrEmpty(ListenerCommandHandler)) { column.Listeners.Command.Handler = ListenerCommandHandler; } column.PreRender += AddCommandItems; ConfigureColumnHandler?.Invoke(column); return(column); void AddCommandItems(object sender, EventArgs e) { foreach (var command in ImageCommands) { column.Commands.Add(command); } } }
/// <summary> /// Loads top level entry list /// </summary> /// <history> /// [tamttt] 20/10/2004 Created /// </history> private void BindGrid() { EnableView(true); foreach (DataGridColumn column in grdEntries.Columns) { if (column.GetType() == typeof(ImageCommandColumn)) { //Manage Delete Confirm JS ImageCommandColumn imageColumn = (ImageCommandColumn)column; if (imageColumn.CommandName == "Delete") { imageColumn.OnClickJS = Localization.GetString("DeleteItem"); if (SystemList) { column.Visible = false; } else { column.Visible = true; } } //Localize Image Column Text if (imageColumn.CommandName != "") { imageColumn.Text = Localization.GetString(imageColumn.CommandName, this.LocalResourceFile); } } } grdEntries.DataSource = SelectedList; //selList grdEntries.DataBind(); this.lblEntryCount.Text = SelectedList.Count + " entries"; }
private void SetUpGrid(DataGrid grid, string nameColumnDataField, string idColumnDataField, string permissionHeaderText) { grid.Columns.Clear(); var nameColumn = new BoundColumn { HeaderText = permissionHeaderText, DataField = nameColumnDataField }; nameColumn.ItemStyle.CssClass = "permissionHeader"; nameColumn.HeaderStyle.CssClass = "permissionHeader"; grid.Columns.Add(nameColumn); var idColumn = new BoundColumn { HeaderText = "", DataField = idColumnDataField, Visible = false }; grid.Columns.Add(idColumn); foreach (PermissionInfo permission in _permissions) { var templateCol = new TemplateColumn(); var columnTemplate = new PermissionTriStateTemplate(permission) { IsFullControl = IsFullControl(permission), IsView = IsViewPermisison(permission), SupportDenyMode = SupportsDenyPermissions(permission) }; templateCol.ItemTemplate = columnTemplate; var locName = (permission.ModuleDefID <= 0) ? Localization.GetString(permission.PermissionName + ".Permission", PermissionProvider.Instance().LocalResourceFile) //system permission : (!String.IsNullOrEmpty(ResourceFile) ? Localization.GetString(permission.PermissionName + ".Permission", ResourceFile) //custom permission : ""); templateCol.HeaderText = !String.IsNullOrEmpty(locName) ? locName : permission.PermissionName; templateCol.HeaderStyle.Wrap = true; grid.Columns.Add(templateCol); } var actionsColumn = new ImageCommandColumn { CommandName = "Delete/" + nameColumnDataField, KeyField = idColumnDataField, IconKey = "Delete", IconSize = "16x16", IconStyle = "PermissionGrid", HeaderText = Localization.GetString("PermissionActionsHeader.Text", PermissionProvider.Instance().LocalResourceFile) }; grid.Columns.Add(actionsColumn); grid.ItemCommand += grid_ItemCommand; }
/// <summary> /// Page_Init runs when the control is initialised /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 02/16/2006 Created /// </history> protected void Page_Init(Object sender, EventArgs e) { this.cmdRefresh.Click += new EventHandler(cmdRefresh_Click); this.cmdUpdate.Click += new EventHandler(cmdUpdate_Click); foreach (DataGridColumn column in grdProfileProperties.Columns) { if (column.GetType() == typeof(CheckBoxColumn)) { if (SupportsRichClient() == false) { CheckBoxColumn cbColumn = (CheckBoxColumn)column; cbColumn.CheckedChanged += new DNNDataGridCheckedColumnEventHandler(grdProfileProperties_ItemCheckedChanged); } } else if (column.GetType() == typeof(ImageCommandColumn)) { //Manage Delete Confirm JS ImageCommandColumn imageColumn = (ImageCommandColumn)column; switch (imageColumn.CommandName) { case "Delete": imageColumn.OnClickJS = Localization.GetString("DeleteItem"); imageColumn.Text = Localization.GetString("Delete", this.LocalResourceFile); break; case "Edit": //The Friendly URL parser does not like non-alphanumeric characters //so first create the format string with a dummy value and then //replace the dummy value with the FormatString place holder string formatString = EditUrl("PropertyDefinitionID", "KEYFIELD", "EditProfileProperty"); formatString = formatString.Replace("KEYFIELD", "{0}"); imageColumn.NavigateURLFormatString = formatString; break; case "MoveUp": imageColumn.Text = Localization.GetString("MoveUp", this.LocalResourceFile); break; case "MoveDown": imageColumn.Text = Localization.GetString("MoveDown", this.LocalResourceFile); break; } } } }
/// <summary> /// Page_Init runs when the control is initialised /// </summary> /// <history> /// [cnurse] 9/10/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> protected void Page_Init(Object sender, EventArgs e) { foreach (DataGridColumn column in grdRoles.Columns) { if (column.GetType() == typeof(ImageCommandColumn)) { //Manage Delete Confirm JS ImageCommandColumn imageColumn = (ImageCommandColumn)column; if (imageColumn.CommandName == "Delete") { imageColumn.OnClickJS = Localization.GetString("DeleteItem"); } //Manage Edit Column NavigateURLFormatString if (imageColumn.CommandName == "Edit") { //The Friendly URL parser does not like non-alphanumeric characters //so first create the format string with a dummy value and then //replace the dummy value with the FormatString place holder string formatString = EditUrl("RoleID", "KEYFIELD", "Edit"); formatString = formatString.Replace("KEYFIELD", "{0}"); imageColumn.NavigateURLFormatString = formatString; } //Manage Roles Column NavigateURLFormatString if (imageColumn.CommandName == "UserRoles") { //The Friendly URL parser does not like non-alphanumeric characters //so first create the format string with a dummy value and then //replace the dummy value with the FormatString place holder string formatString = Globals.NavigateURL(TabId, "User Roles", "RoleId=KEYFIELD"); formatString = formatString.Replace("KEYFIELD", "{0}"); imageColumn.NavigateURLFormatString = formatString; } //Localize Image Column Text if (!String.IsNullOrEmpty(imageColumn.CommandName)) { imageColumn.Text = Localization.GetString(imageColumn.CommandName, this.LocalResourceFile); } } } }
/// <summary> /// Page_Init runs when the control is initialised /// </summary> /// <history> /// [cnurse] 7/06/2006 Created /// </history> protected void Page_Init(Object sender, EventArgs e) { this.cmdAddRule.Click += new EventHandler(cmdAddRule_Click); foreach (DataGridColumn column in grdRules.Columns) { if (column.GetType() == typeof(ImageCommandColumn)) { //Manage Delete Confirm JS ImageCommandColumn imageColumn = (ImageCommandColumn)column; if (imageColumn.CommandName == "Delete") { imageColumn.OnClickJS = Localization.GetString("DeleteItem"); } //Localize Image Column Text if (!String.IsNullOrEmpty(imageColumn.CommandName)) { imageColumn.Text = Localization.GetString(imageColumn.CommandName, this.LocalResourceFile); } } } }
/// <summary> /// Page_Init runs when the control is initialised /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/10/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> protected void Page_Init(Object sender, EventArgs e) { foreach (DataGridColumn column in grdUsers.Columns) { bool isVisible; string header = column.HeaderText; if (header == "" || header.ToLower() == "username") { isVisible = true; } else { string settingKey = "Column_" + header; object setting = UserModuleBase.GetSetting(UsersPortalId, settingKey); isVisible = Convert.ToBoolean(setting); } if (column.GetType() == typeof(ImageCommandColumn)) { //Manage Delete Confirm JS ImageCommandColumn imageColumn = (ImageCommandColumn)column; if (imageColumn.CommandName == "Delete") { imageColumn.OnClickJS = Localization.GetString("DeleteItem"); } //Manage Edit Column NavigateURLFormatString if (imageColumn.CommandName == "Edit") { //The Friendly URL parser does not like non-alphanumeric characters //so first create the format string with a dummy value and then //replace the dummy value with the FormatString place holder string formatString = EditUrl("UserId", "KEYFIELD", "Edit"); formatString = formatString.Replace("KEYFIELD", "{0}"); imageColumn.NavigateURLFormatString = formatString; } //Manage Roles Column NavigateURLFormatString if (imageColumn.CommandName == "UserRoles") { if (IsHostMenu) { isVisible = false; } else { //The Friendly URL parser does not like non-alphanumeric characters //so first create the format string with a dummy value and then //replace the dummy value with the FormatString place holder string formatString = Globals.NavigateURL(TabId, "User Roles", "UserId=KEYFIELD"); formatString = formatString.Replace("KEYFIELD", "{0}"); imageColumn.NavigateURLFormatString = formatString; } } //Localize Image Column Text if (!String.IsNullOrEmpty(imageColumn.CommandName)) { imageColumn.Text = Localization.GetString(imageColumn.CommandName, this.LocalResourceFile); } } column.Visible = isVisible; } }