// How can I set the confirm text of delete icon to selected langugae - LOOK BELOW protected void repeaterData_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { ConfirmButtonExtender ConfirmButtonExtForDelete = (ConfirmButtonExtender)e.Item.FindControl("ConfirmButtonExtForDelete"); ConfirmButtonExtForDelete.ConfirmText = Properties.Resources.ConfirmDeleteMessage; } }
/// <summary> /// Try to localize the controls. /// The resource keys should be the same as the ID of the control that should be translated. /// You can override this behavior by adding a prefix with the UserControl name and a /// semicolon, for example: "Articles:lblTitle". /// </summary> /// <param name="control"></param> protected virtual void LocalizeControls(Control control) { foreach (Control childControl in control.Controls) { // First try to find a string for this specific user control. // Use the name of BaseType because we need the code-behind class. string resourceKey = GetType().BaseType.Name + ":" + childControl.ID; string localizedText = GetText(resourceKey); if (localizedText == null) { // No translation found with the user control prefix. Try to find a translation that // only has the control ID as key if (childControl.ID != null) { localizedText = GetText(childControl.ID); } } if (!String.IsNullOrEmpty(localizedText)) { if ((childControl is Label) && !(childControl is BaseValidator)) { Label label = (Label)childControl; label.Text = localizedText; } if (childControl is Button) { Button button = (Button)childControl; button.Text = localizedText; } if (childControl is LinkButton) { LinkButton linkButton = (LinkButton)childControl; linkButton.Text = localizedText; } if (childControl is HyperLink) { HyperLink hyperLink = (HyperLink)childControl; hyperLink.Text = localizedText; } if (childControl is RadioButton) { RadioButton radioButton = (RadioButton)childControl; radioButton.Text = localizedText; } else if (childControl is BaseValidator) { BaseValidator validator = (BaseValidator)childControl; validator.ErrorMessage = localizedText; } else if (childControl is CheckBox) { CheckBox checkBox = (CheckBox)childControl; checkBox.Text = localizedText; } else if (childControl is ConfirmButtonExtender) { ConfirmButtonExtender confirmExtender = (ConfirmButtonExtender)childControl; confirmExtender.ConfirmText = localizedText; } } // Recursive translate childcontrols LocalizeControls(childControl); } }
protected void gvResult_ItemDataBound(object sender, DataGridItemEventArgs e) { LanguageCollection dt = ((LanguageCollection)this.gvResult.DataSource); if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { PubEntAdmin.BLL.Language l_conf = dt[e.Item.ItemIndex]; ((Label)e.Item.Cells[1].Controls[1]).Text = Server.HtmlEncode(l_conf.LngName); //delete btn col Button l_able = e.Item.Cells[5].FindControl("lnkbtnDel") as Button; if (l_conf.Checked) { ((Label)e.Item.Cells[2].Controls[1]).Text = "Active"; l_able.Text = "Inactivate"; Panel l_pnl = e.Item.Cells[5].FindControl("pnlConfirmDel") as Panel; ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to inactivate this Lookup Value [" + Server.HtmlEncode(l_conf.LngName) + "]?"; } else { ((Label)e.Item.Cells[2].Controls[1]).Text = "Inactive"; l_able.Text = "Activate"; Panel l_pnl = e.Item.Cells[5].FindControl("pnlConfirmDel") as Panel; ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to activate this Lookup Value [" + Server.HtmlEncode(l_conf.LngName) + "]?"; } } else if (e.Item.ItemType == ListItemType.EditItem) { PubEntAdmin.BLL.Language l_conf = dt[e.Item.ItemIndex]; String status = ""; if (l_conf.Checked == true) { status = "Active"; } else { status = "Inactive"; } ((Label)e.Item.Cells[2].Controls[1]).Text = status; if (e.Item.Cells[3].Controls[2] is Button) { Button l_btnCancel = ((Button)e.Item.Cells[3].Controls[2]); l_btnCancel.ID = "gvResult_Cancel"; Panel l_panel = new Panel(); l_panel.ID = "l_panel"; l_panel.CssClass = "modalPopup"; l_panel.Style.Add("display", "none"); l_panel.Width = Unit.Pixel(233); Label l_label = new Label(); l_label.Text = "Are you sure you want to continue?"; HtmlGenericControl l_div = new HtmlGenericControl(); Button l_ok = new Button(); Button l_cancel = new Button(); l_ok.ID = "l_ok"; l_ok.Text = "OK"; l_cancel.ID = "l_cancel"; l_cancel.Text = "Cancel"; l_div.Controls.Add(l_ok); l_div.Controls.Add(new LiteralControl(" ")); l_div.Controls.Add(l_cancel); l_div.Attributes.Add("align", "center"); l_panel.Controls.Add(l_label); l_panel.Controls.Add(new LiteralControl("<br>")); l_panel.Controls.Add(new LiteralControl("<br>")); l_panel.Controls.Add(l_div); ModalPopupExtender l_mpe = new ModalPopupExtender(); l_mpe.ID = "l_mpe"; l_mpe.TargetControlID = l_btnCancel.ID; l_mpe.PopupControlID = l_panel.ID; l_mpe.BackgroundCssClass = "modalBackground"; l_mpe.DropShadow = true; l_mpe.OkControlID = l_ok.ID; l_mpe.CancelControlID = l_cancel.ID; ConfirmButtonExtender l_cbe = new ConfirmButtonExtender(); l_cbe.TargetControlID = l_btnCancel.ID; l_cbe.ConfirmText = ""; l_cbe.DisplayModalPopupID = l_mpe.ID; e.Item.Cells[3].Controls.Add(l_panel); e.Item.Cells[3].Controls.Add(l_mpe); e.Item.Cells[3].Controls.Add(l_cbe); } //delete btn col Button l_able = e.Item.Cells[5].FindControl("lnkbtnDel") as Button; if (l_conf.Checked) { ((Label)e.Item.Cells[2].Controls[1]).Text = "Active"; l_able.Text = "Inactivate"; Panel l_pnl = e.Item.Cells[5].FindControl("pnlConfirmDel") as Panel; ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to inactivate this Lookup Value [" + Server.HtmlEncode(l_conf.LngName) + "]?"; } else { ((Label)e.Item.Cells[2].Controls[1]).Text = "Inactive"; l_able.Text = "Activate"; Panel l_pnl = e.Item.Cells[5].FindControl("pnlConfirmDel") as Panel; ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to activate this Lookup Value [" + Server.HtmlEncode(l_conf.LngName) + "]?"; } } }
private void UpdateDirectoryContentPanel() { FileManagerUpdatePanel.Triggers.Clear(); DirectoryInfo directory = new DirectoryInfo(RootDir + RequestedPath); CurrentDirectoryDirectories = directory.GetDirectories(); CurrentDirectoryFiles = directory.GetFiles(); HtmlTableRow header = (HtmlTableRow)fileManagerFolderContentTable.Controls[0]; fileManagerFolderContentTable.Controls.Clear(); fileManagerFolderContentTable.Controls.Add(header); if (!string.IsNullOrEmpty(RequestedPath)) { HtmlTableRow tr = new HtmlTableRow(); tr.Attributes.Add("onmouseover", "onTableRowMouseOver(this)"); tr.Attributes.Add("onmouseout", "onTableRowMouseLeft(this)"); HtmlTableCell checkCell = new HtmlTableCell(); checkCell.Attributes.Add("class", "fileManagerFolderContentTableSelectCell"); tr.Controls.Add(checkCell); HtmlTableCell nameCell = new HtmlTableCell(); LinkButton nameLinkButton = new LinkButton(); nameLinkButton.Text = ".."; nameLinkButton.ID = ".."; if (nameLinkButton.Text.Length > 80) { nameLinkButton.Text = nameLinkButton.Text.Substring(0, 80) + "..."; } nameLinkButton.Click += new System.EventHandler(DirectoryContentLink_Click_Handler); nameCell.Controls.Add(nameLinkButton); nameCell.Attributes.Add("class", "fileManagerFolderContentTableNameCell"); tr.Controls.Add(nameCell); HtmlTableCell lengthCell = new HtmlTableCell(); lengthCell.InnerText = "Папка"; lengthCell.Attributes.Add("class", "fileManagerFolderContentTableLengthCell"); tr.Controls.Add(lengthCell); HtmlTableCell lastChangeCell = new HtmlTableCell(); Literal LastChangeLiteral = new Literal(); lastChangeCell.Controls.Add(LastChangeLiteral); lastChangeCell.Attributes.Add("class", "fileManagerFolderContentTableLastModificationCell"); tr.Controls.Add(lastChangeCell); HtmlTableCell downloadCell = new HtmlTableCell(); downloadCell.Attributes.Add("class", "fileManagerFolderContentTableDownloadCell"); tr.Controls.Add(downloadCell); HtmlTableCell deleteCell = new HtmlTableCell(); deleteCell.Attributes.Add("class", "fileManagerFolderContentTableDeleteCell"); tr.Controls.Add(deleteCell); fileManagerFolderContentTable.Controls.Add(tr); } foreach (DirectoryInfo dir in CurrentDirectoryDirectories) { HtmlTableRow tr = new HtmlTableRow(); tr.Attributes.Add("onmouseover", "onTableRowMouseOver(this)"); tr.Attributes.Add("onmouseout", "onTableRowMouseLeft(this)"); tr.Attributes.Add("onclick", "onTableRowClick(this, event);"); HtmlTableCell checkCell = new HtmlTableCell(); CheckBox check = new CheckBox(); check.ID = dir.Name.GetHashCode() + "$Directory"; checkCell.Controls.Add(check); if (SelectedDirectories.Contains(dir.Name)) { check.Checked = true; } check.Attributes.Add("onclick", "stopBubble(event);"); checkCell.Attributes.Add("class", "fileManagerFolderContentTableSelectCell"); tr.Controls.Add(checkCell); HtmlTableCell nameCell = new HtmlTableCell(); LinkButton nameLinkButton = new LinkButton(); nameLinkButton.Text = dir.Name; nameLinkButton.ID = dir.Name.GetHashCode().ToString(); if (nameLinkButton.Text.Length > 80) { nameLinkButton.Text = nameLinkButton.Text.Substring(0, 80) + "..."; } nameLinkButton.Click += new System.EventHandler(DirectoryContentLink_Click_Handler); nameCell.Controls.Add(nameLinkButton); nameCell.Attributes.Add("class", "fileManagerFolderContentTableNameCell"); tr.Controls.Add(nameCell); HtmlTableCell lengthCell = new HtmlTableCell(); lengthCell.InnerText = "Папка"; lengthCell.Attributes.Add("class", "fileManagerFolderContentTableLengthCell"); tr.Controls.Add(lengthCell); HtmlTableCell lastChangeCell = new HtmlTableCell(); Literal LastChangeLiteral = new Literal(); LastChangeLiteral.Text = dir.LastWriteTime.ToString("dd MMM yyyy H:MM", CultureInfo.CreateSpecificCulture("en-US")).ToUpper(); lastChangeCell.Controls.Add(LastChangeLiteral); lastChangeCell.Attributes.Add("class", "fileManagerFolderContentTableLastModificationCell"); tr.Controls.Add(lastChangeCell); HtmlTableCell downloadCell = new HtmlTableCell(); downloadCell.Attributes.Add("class", "fileManagerFolderContentTableDownloadCell"); tr.Controls.Add(downloadCell); HtmlTableCell deleteCell = new HtmlTableCell(); deleteCell.Attributes.Add("class", "fileManagerFolderContentTableDeleteCell"); ImageButton deleteButton = new ImageButton(); deleteButton.ImageUrl = "images/delete.png"; deleteButton.ToolTip = "Удалить"; deleteButton.AlternateText = "Удалить"; deleteButton.ID = dir.Name.GetHashCode() + "_deleteButton"; deleteButton.CommandName = dir.Name; deleteButton.Command += new System.Web.UI.WebControls.CommandEventHandler(DeleteButton_ClickHandler); ConfirmButtonExtender es = new ConfirmButtonExtender(); es.ID = dir.Name.GetHashCode().ToString() + "_DeleteConfirmer"; es.TargetControlID = deleteButton.ID; es.ConfirmText = "Вы дейстивтельно хотите удалить эту папку?"; deleteCell.Controls.Add(es); deleteCell.Controls.Add(deleteButton); tr.Controls.Add(deleteCell); fileManagerFolderContentTable.Controls.Add(tr); } foreach (FileInfo file in CurrentDirectoryFiles) { HtmlTableRow tr = new HtmlTableRow(); tr.Attributes.Add("onmouseover", "onTableRowMouseOver(this)"); tr.Attributes.Add("onmouseout", "onTableRowMouseLeft(this)"); tr.Attributes.Add("onclick", "onTableRowClick(this, event);"); HtmlTableCell checkCell = new HtmlTableCell(); CheckBox check = new CheckBox(); check.Attributes.Add("onclick", "stopBubble(event);"); check.ID = file.Name.GetHashCode() + "$File"; if (SelectedFiles.Contains(file.Name)) { check.Checked = true; } checkCell.Controls.Add(check); checkCell.Attributes.Add("class", "fileManagerFolderContentTableSelectCell"); tr.Controls.Add(checkCell); HtmlTableCell nameCell = new HtmlTableCell(); HtmlAnchor nameLink = new HtmlAnchor(); nameLink.ID = file.Name.GetHashCode() + "Link"; nameLink.HRef = Request.AppRelativeCurrentExecutionFilePath + "?path=" + RequestedPath + "\\" + file.Name; nameLink.InnerText = file.Name; if (nameLink.InnerText.Length > 80) { nameLink.InnerText = nameLink.InnerText.Substring(0, 80) + "..."; } var nameLinkContainer = new HtmlGenericControl("div"); nameLinkContainer.Controls.Add(nameLink); nameCell.Controls.Add(nameLinkContainer); nameCell.Attributes.Add("class", "fileManagerFolderContentTableNameCell"); tr.Controls.Add(nameCell); HtmlTableCell lengthCell = new HtmlTableCell(); Literal lengthLiteral = new Literal(); long length = 0; if (Cache[file.FullName + "_Length"] != null) { length = (long)Cache[file.FullName + "_Length"]; } else { length = file.Length; CacheDependency cd = new CacheDependency(file.FullName); Cache.Insert(file.FullName + "_Length", length, cd, DateTime.MaxValue, TimeSpan.FromMinutes(5)); } lengthLiteral.Text = Math.Ceiling((double)length / 1024).ToString() + " КБ"; lengthCell.Controls.Add(lengthLiteral); lengthCell.Attributes.Add("class", "fileManagerFolderContentTableLengthCell"); tr.Controls.Add(lengthCell); HtmlTableCell lastChangeCell = new HtmlTableCell(); Literal LastChangeLiteral = new Literal(); DateTime lastChange; if (Cache[file.FullName + "_LastWriteTime"] != null) { lastChange = (DateTime)Cache[file.FullName + "_LastWriteTime"]; } else { lastChange = file.LastWriteTime; Cache.Insert(file.FullName + "_LastWriteTime", lastChange, null, DateTime.MaxValue, TimeSpan.FromMinutes(5)); } LastChangeLiteral.Text = lastChange.ToString("dd MMM yyyy H:MM", CultureInfo.CreateSpecificCulture("en-US")).ToUpper(); lastChangeCell.Controls.Add(LastChangeLiteral); lastChangeCell.Attributes.Add("class", "fileManagerFolderContentTableLastModificationCell"); tr.Controls.Add(lastChangeCell); HtmlTableCell downloadCell = new HtmlTableCell(); downloadCell.Attributes.Add("class", "fileManagerFolderContentTableDownloadCell"); ImageButton downButton = new ImageButton(); downButton.ImageUrl = "images/download.png"; downButton.AlternateText = "Скачать"; downButton.ToolTip = "Скачать"; downButton.ID = file.Name + "_downlodButton"; downButton.Attributes.Add("onclick", "downloadFile(event, \'" + RequestedPath + file.Name + "\');"); downloadCell.Controls.Add(downButton); tr.Controls.Add(downloadCell); HtmlTableCell deleteCell = new HtmlTableCell(); deleteCell.Attributes.Add("class", "fileManagerFolderContentTableDeleteCell"); ImageButton deleteButton = new ImageButton(); deleteButton.ImageUrl = "images/delete.png"; deleteButton.ToolTip = "Удалить"; deleteButton.AlternateText = "Удалить"; deleteButton.ID = file.Name.GetHashCode() + "_deleteButton"; deleteButton.CommandName = file.Name; deleteButton.Command += new System.Web.UI.WebControls.CommandEventHandler(DeleteButton_ClickHandler); deleteCell.Controls.Add(deleteButton); ConfirmButtonExtender es = new ConfirmButtonExtender(); es.ID = file.Name.GetHashCode() + "_DeleteConfirmer"; es.TargetControlID = deleteButton.ID; es.ConfirmText = "Вы дейстивтельно хотите удалить этот файл?"; deleteCell.Controls.Add(es); deleteCell.Controls.Add(deleteButton); tr.Controls.Add(deleteCell); fileManagerFolderContentTable.Controls.Add(tr); } }
protected void gvResult_ItemCreated(object source, DataGridItemEventArgs e) { if ((e.Item.ItemType == ListItemType.EditItem)) { CompareValidator comValDates_gd = new CompareValidator(); comValDates_gd.ErrorMessage = "<br/>Start Date cannot be greater than End Date."; comValDates_gd.ControlToCompare = "txtStartDate_gd"; comValDates_gd.ControlToValidate = "txtEndDate_gd"; comValDates_gd.ValidationGroup = "EditVal"; comValDates_gd.Display = ValidatorDisplay.Dynamic; comValDates_gd.Type = ValidationDataType.Date; comValDates_gd.Operator = ValidationCompareOperator.GreaterThan; if (e.Item.Cells[5].Controls[0] is LinkButton) { LinkButton l_btnUpdate = ((LinkButton)e.Item.Cells[5].Controls[0]); l_btnUpdate.ID = "l_btnUpdate"; l_btnUpdate.ValidationGroup = "EditVal"; } e.Item.Cells[5].Controls.Add(comValDates_gd); if (e.Item.Cells[5].Controls[2] is LinkButton) { LinkButton l_btnCancel = ((LinkButton)e.Item.Cells[5].Controls[2]); l_btnCancel.ID = "l_btnCancel"; Panel l_panel = new Panel(); l_panel.ID = "l_panel"; l_panel.CssClass = "modalPopup"; l_panel.Style.Add("display", "none"); l_panel.Width = Unit.Pixel(233); Label l_label = new Label(); l_label.Text = "Are you sure you want to continue?"; HtmlGenericControl l_div = new HtmlGenericControl(); Button l_ok = new Button(); Button l_cancel = new Button(); l_ok.ID = "l_ok"; l_ok.Text = "OK"; l_cancel.ID = "l_cancel"; l_cancel.Text = "Cancel"; l_div.Controls.Add(l_ok); l_div.Controls.Add(new LiteralControl(" ")); l_div.Controls.Add(l_cancel); l_div.Attributes.Add("align", "center"); l_panel.Controls.Add(l_label); l_panel.Controls.Add(new LiteralControl("<br>")); l_panel.Controls.Add(new LiteralControl("<br>")); l_panel.Controls.Add(l_div); ModalPopupExtender l_mpe = new ModalPopupExtender(); l_mpe.ID = "l_mpe"; l_mpe.TargetControlID = l_btnCancel.ID; l_mpe.PopupControlID = l_panel.ID; l_mpe.BackgroundCssClass = "modalBackground"; l_mpe.DropShadow = true; l_mpe.OkControlID = l_ok.ID; l_mpe.CancelControlID = l_cancel.ID; ConfirmButtonExtender l_cbe = new ConfirmButtonExtender(); l_cbe.TargetControlID = l_btnCancel.ID; l_cbe.ConfirmText = ""; l_cbe.DisplayModalPopupID = l_mpe.ID; e.Item.Cells[5].Controls.Add(l_panel); e.Item.Cells[5].Controls.Add(l_cbe); e.Item.Cells[5].Controls.Add(l_mpe); } } }
protected void gvResult_ItemDataBound(object sender, DataGridItemEventArgs e) { SeriesCollection dt = ((SeriesCollection)this.gvResult.DataSource); if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { PubEntAdmin.BLL.Series l_conf = dt[e.Item.ItemIndex]; ((Label)e.Item.Cells[1].Controls[1]).Text = Server.HtmlEncode(l_conf.SreName); //delete btn col //Button l_able = e.Item.Cells[5].FindControl("lnkbtnDel") as Button; Button l_able = e.Item.Cells[6].FindControl("lnkbtnDel") as Button; if (l_conf.Checked) { ((Label)e.Item.Cells[2].Controls[1]).Text = "Active"; l_able.Text = "Inactivate"; //Panel l_pnl = e.Item.Cells[5].FindControl("pnlConfirmDel") as Panel; Panel l_pnl = e.Item.Cells[6].FindControl("pnlConfirmDel") as Panel; ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to inactivate this Lookup Value [" + Server.HtmlEncode(l_conf.SreName) + "]?"; } else { ((Label)e.Item.Cells[2].Controls[1]).Text = "Inactive"; l_able.Text = "Activate"; //Panel l_pnl = e.Item.Cells[5].FindControl("pnlConfirmDel") as Panel; Panel l_pnl = e.Item.Cells[6].FindControl("pnlConfirmDel") as Panel; ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to activate this Lookup Value [" + Server.HtmlEncode(l_conf.SreName) + "]?"; } #region Label_NCIPL_CC Label lblLiveIntName2 = e.Item.Cells[3].Controls[1] as Label; if (l_conf.InNCIPL == true && l_conf.InNCIPL_CC == true) { lblLiveIntName2.Text = "NCIPL<br/>NCIPLcc"; } else if (l_conf.InNCIPL == true) { lblLiveIntName2.Text = "NCIPL"; } else if (l_conf.InNCIPL_CC == true) { lblLiveIntName2.Text = "NCIPLcc"; } #endregion //#region Label_NCIPL_CC //if (l_conf.InNCIPL == true && l_conf.InNCIPL_CC == true) // ((Label) e.Item.Cells[3].Controls[1]).Text = "NCIPL<br/>NCIPLcc"; //else if (l_conf.InNCIPL == true) // ((Label)e.Item.Cells[3].Controls[1]).Text = "NCIPL"; //else if (l_conf.InNCIPL_CC == true) // ((Label)e.Item.Cells[3].Controls[1]).Text = "NCIPLcc"; //#endregion } else if (e.Item.ItemType == ListItemType.EditItem) { PubEntAdmin.BLL.Series l_conf = dt[e.Item.ItemIndex]; String status = ""; if (l_conf.Checked == true) { status = "Active"; } else { status = "Inactive"; } ((Label)e.Item.Cells[2].Controls[1]).Text = status; //if (e.Item.Cells[3].Controls[2] is Button) if (e.Item.Cells[4].Controls[2] is Button) { //Button l_btnCancel = ((Button)e.Item.Cells[3].Controls[2]); Button l_btnCancel = ((Button)e.Item.Cells[4].Controls[2]); l_btnCancel.ID = "gvResult_Cancel"; Panel l_panel = new Panel(); l_panel.ID = "l_panel"; l_panel.CssClass = "modalPopup"; l_panel.Style.Add("display", "none"); l_panel.Width = Unit.Pixel(233); Label l_label = new Label(); l_label.Text = "Are you sure you want to continue?"; HtmlGenericControl l_div = new HtmlGenericControl(); Button l_ok = new Button(); Button l_cancel = new Button(); l_ok.ID = "l_ok"; l_ok.Text = "OK"; l_cancel.ID = "l_cancel"; l_cancel.Text = "Cancel"; l_div.Controls.Add(l_ok); l_div.Controls.Add(new LiteralControl(" ")); l_div.Controls.Add(l_cancel); l_div.Attributes.Add("align", "center"); l_panel.Controls.Add(l_label); l_panel.Controls.Add(new LiteralControl("<br>")); l_panel.Controls.Add(new LiteralControl("<br>")); l_panel.Controls.Add(l_div); ModalPopupExtender l_mpe = new ModalPopupExtender(); l_mpe.ID = "l_mpe"; l_mpe.TargetControlID = l_btnCancel.ID; l_mpe.PopupControlID = l_panel.ID; l_mpe.BackgroundCssClass = "modalBackground"; l_mpe.DropShadow = true; l_mpe.OkControlID = l_ok.ID; l_mpe.CancelControlID = l_cancel.ID; ConfirmButtonExtender l_cbe = new ConfirmButtonExtender(); l_cbe.TargetControlID = l_btnCancel.ID; l_cbe.ConfirmText = ""; l_cbe.DisplayModalPopupID = l_mpe.ID; //e.Item.Cells[3].Controls.Add(l_panel); //e.Item.Cells[3].Controls.Add(l_mpe); //e.Item.Cells[3].Controls.Add(l_cbe); e.Item.Cells[4].Controls.Add(l_panel); e.Item.Cells[4].Controls.Add(l_mpe); e.Item.Cells[4].Controls.Add(l_cbe); } //delete btn col //Button l_able = e.Item.Cells[5].FindControl("lnkbtnDel") as Button; Button l_able = e.Item.Cells[6].FindControl("lnkbtnDel") as Button; if (l_conf.Checked) { ((Label)e.Item.Cells[2].Controls[1]).Text = "Active"; l_able.Text = "Inactivate"; //Panel l_pnl = e.Item.Cells[5].FindControl("pnlConfirmDel") as Panel; Panel l_pnl = e.Item.Cells[6].FindControl("pnlConfirmDel") as Panel; ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to inactivate this Lookup Value [" + Server.HtmlEncode(l_conf.SreName) + "]?"; } else { ((Label)e.Item.Cells[2].Controls[1]).Text = "Inactive"; l_able.Text = "Activate"; //Panel l_pnl = e.Item.Cells[5].FindControl("pnlConfirmDel") as Panel; Panel l_pnl = e.Item.Cells[6].FindControl("pnlConfirmDel") as Panel; ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to activate this Lookup Value [" + Server.HtmlEncode(l_conf.SreName) + "]?"; } #region Checkboxes_NCIPL_CC LiveIntSel LiveIntSel2 = (LiveIntSel)e.Item.Cells[3].Controls[1]; LiveIntSel2.SetInterfacesToShow("Series"); //Hide unwanted interfaces if (l_conf.InNCIPL) { LiveIntSel2.InNCIPL = true; } if (l_conf.InNCIPL_CC) { LiveIntSel2.InROO = true; } #endregion } }
protected void gvResult_ItemDataBound(object sender, DataGridItemEventArgs e) { SubjectCollection dt = ((SubjectCollection)this.gvResult.DataSource); if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { PubEntAdmin.BLL.Subject l_conf = dt[e.Item.ItemIndex]; e.Item.Cells[0].Text = l_conf.CannotRem.ToString(); ((Label)e.Item.Cells[2].Controls[1]).Text = Server.HtmlEncode(l_conf.SubjName); //---------------------------------------- string a = ""; if (l_conf.InNCIPL) { a = "NCIPL"; } if (l_conf.InROO) { if (a.Length != 0) { a += "<br />"; } a += "NCIPLcc"; } if (l_conf.InExh) { if (a.Length != 0) { a += "<br />"; } a += "Exhibit"; } if (l_conf.InCatalog) { if (a.Length != 0) { a += "<br />"; } a += "Catalog"; } if (a.Length != 0) { ((Label)e.Item.Cells[3].Controls[1]).Text = a; } else { ((Label)e.Item.Cells[3].Controls[1]).Text = "N/A"; } //---------------------------------------- ((Label)e.Item.Cells[4].Controls[1]).Text = l_conf.HasSubCat.ToString(); //---------------------------------------- ((Label)e.Item.FindControl("lblStatus1")).Text = l_conf.Active ? "Active" : "Inactive"; //---------------------------------------- //delete btn col Button l_able = e.Item.Cells[7].FindControl("lnkbtnDel") as Button; if (l_conf.Active) { l_able.Text = "Inactivate"; Panel l_pnl = e.Item.Cells[7].FindControl("pnlConfirmDel") as Panel; ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to inactivate this Subject [" + Server.HtmlEncode(l_conf.SubjName) + "]?<br />NOTE: If the Category has SubCategories they will also be inactivated!"; } else { l_able.Text = "Activate"; Panel l_pnl = e.Item.Cells[7].FindControl("pnlConfirmDel") as Panel; ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to activate this Subject [" + Server.HtmlEncode(l_conf.SubjName) + "]?"; } } else if (e.Item.ItemType == ListItemType.EditItem) { PubEntAdmin.BLL.Subject l_conf = dt[e.Item.ItemIndex]; e.Item.Cells[0].Text = l_conf.CannotRem.ToString(); ((TextBox)e.Item.Cells[2].Controls[1]).Text = Server.HtmlEncode(l_conf.SubjName); //---------------------------------------- if (l_conf.InNCIPL) { ((LiveIntSel)e.Item.Cells[3].Controls[1]).InNCIPL = true; } if (l_conf.InROO) { ((LiveIntSel)e.Item.Cells[3].Controls[1]).InROO = true; } if (l_conf.InExh) { ((LiveIntSel)e.Item.Cells[3].Controls[1]).InExh = true; } if (l_conf.InCatalog) { ((LiveIntSel)e.Item.Cells[3].Controls[1]).InCatalog = true; } //---------------------------------------- if (e.Item.Cells[4].Controls[1] is CheckBox) { CheckBox l_chkboxRemove = ((CheckBox)e.Item.FindControl("ckboxHasSubCat")); l_chkboxRemove.Attributes.Add("onclick", @"(!this.checked)?alert('NOTE:\nALL the SubCategories and SubSubCategories assigned\nto this Category will be disabled!'):''"); ((CheckBox)e.Item.Cells[4].Controls[1]).Checked = l_conf.HasSubCat; } //---------------------------------------- ((Label)e.Item.FindControl("lblStatus2")).Text = l_conf.Active ? "Active" : "Inactive"; //---------------------------------------- if (e.Item.Cells[6].Controls[2] is Button) { Button l_btnCancel = ((Button)e.Item.Cells[6].Controls[2]); l_btnCancel.ID = "gvResult_Cancel"; Panel l_panel = new Panel(); l_panel.ID = "l_panel"; l_panel.CssClass = "modalPopup"; l_panel.Style.Add("display", "none"); l_panel.Width = Unit.Pixel(233); Label l_label = new Label(); l_label.Text = "Are you sure you want to continue?"; HtmlGenericControl l_div = new HtmlGenericControl(); Button l_ok = new Button(); Button l_cancel = new Button(); l_ok.ID = "l_ok"; l_ok.Text = "OK"; l_ok.CssClass = "btn"; l_cancel.ID = "l_cancel"; l_cancel.Text = "Cancel"; l_cancel.CssClass = "btn"; l_div.Controls.Add(l_ok); l_div.Controls.Add(new LiteralControl(" ")); l_div.Controls.Add(l_cancel); l_div.Attributes.Add("align", "center"); l_panel.Controls.Add(l_label); l_panel.Controls.Add(new LiteralControl("<br>")); l_panel.Controls.Add(new LiteralControl("<br>")); l_panel.Controls.Add(l_div); ModalPopupExtender l_mpe = new ModalPopupExtender(); l_mpe.ID = "l_mpe"; l_mpe.TargetControlID = l_btnCancel.ID; l_mpe.PopupControlID = l_panel.ID; l_mpe.BackgroundCssClass = "modalBackground"; l_mpe.DropShadow = true; l_mpe.OkControlID = l_ok.ID; l_mpe.CancelControlID = l_cancel.ID; ConfirmButtonExtender l_cbe = new ConfirmButtonExtender(); l_cbe.TargetControlID = l_btnCancel.ID; l_cbe.ConfirmText = ""; l_cbe.DisplayModalPopupID = l_mpe.ID; e.Item.Cells[5].Controls.Add(l_panel); e.Item.Cells[5].Controls.Add(l_mpe); e.Item.Cells[5].Controls.Add(l_cbe); } //---------------------------------------- //delete btn col Button l_able = e.Item.Cells[7].FindControl("lnkbtnDel") as Button; if (l_conf.Active) { l_able.Text = "Inactivate"; Panel l_pnl = e.Item.Cells[7].FindControl("pnlConfirmDel") as Panel; ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to inactivate this Subject [" + Server.HtmlEncode(l_conf.SubjName) + "]?<br />NOTE: If the Category has SubCategories they will also be inactivated!"; } else { l_able.Text = "Activate"; Panel l_pnl = e.Item.Cells[7].FindControl("pnlConfirmDel") as Panel; ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to activate this Subject [" + Server.HtmlEncode(l_conf.SubjName) + "]?"; } } }
protected void gvResult_ItemDataBound(object sender, DataGridItemEventArgs e) { ConfCollection dt = ((ConfCollection)this.gvResult.DataSource); if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Conf l_conf = dt[e.Item.ItemIndex]; //((TableCell)e.Item.Cells[0]).Text = l_conf.ConfID.ToString(); ((Label)e.Item.Cells[1].Controls[1]).Text = l_conf.ConfName; ((Label)e.Item.Cells[2].Controls[1]).Text = l_conf.StartDate.ToShortDateString(); ((Label)e.Item.Cells[3].Controls[1]).Text = l_conf.EndDate.ToShortDateString(); ((Label)e.Item.Cells[4].Controls[1]).Text = l_conf.MaxOrder_INTL.ToString(); //delete btn col Button l_able = e.Item.Cells[6].FindControl("lnkbtnDel") as Button; l_able.Text = "Delete"; Panel l_pnl = e.Item.Cells[6].FindControl("pnlConfirmDel") as Panel; ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to delete this Exhibit Record?"; } else if (e.Item.ItemType == ListItemType.EditItem) { Conf l_conf = dt[e.Item.ItemIndex]; //delete btn col Button l_able = e.Item.Cells[6].FindControl("lnkbtnDel") as Button; l_able.Text = "Delete"; Panel l_pnl = e.Item.Cells[6].FindControl("pnlConfirmDel") as Panel; ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to delete this Exhibit Record?"; //confirmation for cancel if (e.Item.Cells[5].Controls[2] is Button) { Button l_btnCancel = ((Button)e.Item.Cells[5].Controls[2]); Panel l_panel = new Panel(); l_panel.ID = "l_panel"; l_panel.CssClass = "modalPopup"; l_panel.Style.Add("display", "none"); l_panel.Width = Unit.Pixel(233); Label l_label = new Label(); l_label.Text = "Are you sure you want to continue?"; HtmlGenericControl l_div = new HtmlGenericControl(); Button l_ok = new Button(); Button l_cancel = new Button(); l_ok.ID = "l_ok"; l_ok.Text = "OK"; l_cancel.ID = "l_cancel"; l_cancel.Text = "Cancel"; l_div.Controls.Add(l_ok); l_div.Controls.Add(new LiteralControl(" ")); l_div.Controls.Add(l_cancel); l_div.Attributes.Add("align", "center"); l_panel.Controls.Add(l_label); l_panel.Controls.Add(new LiteralControl("<br>")); l_panel.Controls.Add(new LiteralControl("<br>")); l_panel.Controls.Add(l_div); ModalPopupExtender l_mpe = new ModalPopupExtender(); l_mpe.ID = "l_mpe"; l_mpe.TargetControlID = l_btnCancel.ID; l_mpe.PopupControlID = l_panel.ID; l_mpe.BackgroundCssClass = "modalBackground"; l_mpe.DropShadow = true; l_mpe.OkControlID = l_ok.ID; l_mpe.CancelControlID = l_cancel.ID; ConfirmButtonExtender l_cbe = new ConfirmButtonExtender(); l_cbe.TargetControlID = l_btnCancel.ID; l_cbe.ConfirmText = ""; l_cbe.DisplayModalPopupID = l_mpe.ID; e.Item.Cells[5].Controls.Add(l_panel); e.Item.Cells[5].Controls.Add(l_mpe); e.Item.Cells[5].Controls.Add(l_cbe); } if (this.gvResult.EditItemIndex != -1) { ((MaskedEditValidator)e.Item.Cells[2].Controls[7]).Enabled = true; ((MaskedEditValidator)e.Item.Cells[3].Controls[7]).Enabled = true; } else { ((MaskedEditValidator)e.Item.Cells[2].Controls[7]).Enabled = false; ((MaskedEditValidator)e.Item.Cells[3].Controls[7]).Enabled = false; } } }