/// <summary> /// Handles the ItemCommand event of the dgFile control. /// </summary> /// <param name="source">The source of the event.</param> /// <param name="e">The <see cref="T:System.Web.UI.WebControls.DataGridCommandEventArgs"/> instance containing the event data.</param> private void dgFile_ItemCommand(object source, DataGridCommandEventArgs e) { if (e.CommandName == "ItemClicked") { dgFile.EditItemIndex = -1; LinkButton lnkName = (LinkButton)e.Item.FindControl("lnkName"); int type = int.Parse(dgFile.DataKeys[e.Item.ItemIndex].ToString()); if (type == 0) { SetCurDir(System.IO.Path.Combine(GetCurDir(), lnkName.Text)); } else if (Settings["FM_DOWNLOADABLEEXT"].ToString() != "") { string filename = System.IO.Path.Combine(GetCurDir(), lnkName.Text); Response.AddHeader("Content-Disposition", "attachment; filename=" + lnkName.Text.Trim()); Response.WriteFile(filename); Response.End(); } if (type == 0) { try { BindData(); } catch (Exception ex) { lblError.Text = ex.Message; } } } }
/// <summary> /// Handles the ItemDataBound event of the dgFile control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.Web.UI.WebControls.DataGridItemEventArgs"/> instance containing the event data.</param> private void dgFile_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.EditItem) { Image imgType = (Image)e.Item.FindControl("imgType"); //PlaceHolder plhImgEdit = (PlaceHolder)e.Item.FindControl("plhImgEdit"); LinkButton lnkName = (LinkButton)e.Item.FindControl("lnkName"); //HyperLink imgACL = (HyperLink)e.Item.FindControl("imgACL"); //HyperLink for Edit Text HyperLink hlImgEdit = new HyperLink(); hlImgEdit.ImageUrl = CurrentTheme.GetModuleImageSRC("btnEdit.gif"); hlImgEdit.NavigateUrl = Path.ApplicationFullPath + "Desktopmodules/Filemanager/EditFile.aspx?ID=" + GetCurDir() + "\\" + DataBinder.Eval(e.Item.DataItem, "filename"); //---- int type = int.Parse(DataBinder.Eval(e.Item.DataItem, "type", "{0}")); if (type == 0) { imgType.ImageUrl = CurrentTheme.GetModuleImageSRC("dir.gif"); e.Item.Cells[2].Text = ""; e.Item.Cells[3].Text = ""; } else { string name = DataBinder.Eval(e.Item.DataItem, "filename", "{0}").Trim().ToLower(); lnkName.Enabled = IsDownloadable(name); string ext = name.Substring(name.LastIndexOf(".") + 1); imgType.ImageUrl = Path.WebPathCombine(Path.ApplicationRoot, "aspnet_client/Ext/" + imageAsign(ext)); } } }
/// <summary> /// Handles the EditCommand event of the dgFile control. /// </summary> /// <param name="source">The source of the event.</param> /// <param name="e">The <see cref="T:System.Web.UI.WebControls.DataGridCommandEventArgs"/> instance containing the event data.</param> private void dgFile_EditCommand(object source, DataGridCommandEventArgs e) { dgFile.EditItemIndex = e.Item.ItemIndex; LinkButton lnkName = (LinkButton)e.Item.FindControl("lnkName"); ViewState["lastSelection"] = lnkName.Text; BindData(); }
/// <summary> /// On Init /// </summary> /// <param name="e"></param> protected override void OnInit(EventArgs e) { //Controls must be created here updateButton = new LinkButton(); cancelButton = new LinkButton(); deleteButton = new LinkButton(); InitializeComponent(); base.OnInit(e); }
/// <summary> /// Raises OnInitEvent /// </summary> /// <param name="e">An <see cref="T:System.EventArgs"></see> that contains the event data.</param> protected override void OnInit(EventArgs e) { //Controls must be created here updateButton = new LinkButton(); cancelButton = new LinkButton(); // Call requested by ASP.NET this.Load += new EventHandler(this.Page_Load); // Call base first base.OnInit(e); }
/// <summary> /// On Init /// </summary> /// <param name="e"></param> protected override void OnInit(EventArgs e) { this.Load += new EventHandler(this.Page_Load); //Controls must be created here updateButton = new LinkButton(); cancelButton = new LinkButton(); deleteButton = new LinkButton(); updateButton.Click += new EventHandler(updateButton_Click); deleteButton.Click += new EventHandler(deleteButton_Click); InitializeComponent(); base.OnInit(e); }
/// <summary> /// Deletes the item. /// </summary> /// <param name="e">The e.</param> private void DeleteItem(DataGridItem e) { LinkButton lnkName = (LinkButton)e.FindControl("lnkName"); int type = int.Parse(dgFile.DataKeys[e.ItemIndex].ToString()); if (type == 0) { Directory.Delete(System.IO.Path.Combine(GetCurDir(), lnkName.Text), true); } else { File.Delete(System.IO.Path.Combine(GetCurDir(), lnkName.Text)); } }
/// <summary> /// Raises the Init event. /// </summary> /// <param name="e"></param> protected override void OnInit(EventArgs e) { this.PlaceHolderButtons.EnableViewState = false; this.PlaceholderButtons2.EnableViewState = false; //Controls must be created here updateButton = new LinkButton(); updateButton.CssClass = "CommandButton"; PlaceHolderButtons.Controls.Add(updateButton); // jminond added to top of property page so no need to scroll for save LinkButton update2 = new LinkButton(); update2.CssClass = "CommandButton"; update2.TextKey = "Apply"; update2.Text = "Apply"; update2.Click += new EventHandler(UpdateButton_Click); PlaceholderButtons2.Controls.Add(update2); PlaceHolderButtons.Controls.Add(new LiteralControl(" ")); PlaceholderButtons2.Controls.Add(new LiteralControl(" ")); saveAndCloseButton = new LinkButton(); saveAndCloseButton.TextKey = "OK"; saveAndCloseButton.Text = "Save and close"; saveAndCloseButton.CssClass = "CommandButton"; PlaceHolderButtons.Controls.Add(saveAndCloseButton); this.saveAndCloseButton.Click += new EventHandler(this.saveAndCloseButton_Click); // jminond added to top of property page so no need to scroll for save LinkButton saveAndCloseButton2 = new LinkButton(); saveAndCloseButton2.TextKey = "OK"; saveAndCloseButton2.Text = "Save and close"; saveAndCloseButton2.CssClass = "CommandButton"; PlaceholderButtons2.Controls.Add(saveAndCloseButton2); saveAndCloseButton2.Click += new EventHandler(this.saveAndCloseButton_Click); PlaceHolderButtons.Controls.Add(new LiteralControl(" ")); PlaceholderButtons2.Controls.Add(new LiteralControl(" ")); moduleSettingsButton = new HyperLink(); moduleSettingsButton.TextKey = "MODULESETTINGS_SETTINGS"; moduleSettingsButton.Text = "Settings"; moduleSettingsButton.CssClass = "CommandButton"; moduleSettingsButton.NavigateUrl = Rainbow.Framework.HttpUrlBuilder.BuildUrl("~/DesktopModules/CoreModules/Admin/PropertyPage.aspx", PageID, ModuleID); PlaceHolderButtons.Controls.Add(moduleSettingsButton); // jminond added to top of property page so no need to scroll for save HyperLink moduleSettingsButton2 = new HyperLink(); moduleSettingsButton2.TextKey = "MODULESETTINGS_SETTINGS"; moduleSettingsButton2.Text = "Settings"; moduleSettingsButton2.CssClass = "CommandButton"; moduleSettingsButton2.NavigateUrl = Rainbow.Framework.HttpUrlBuilder.BuildUrl("~/DesktopModules/CoreModules/Admin/PropertyPage.aspx", PageID, ModuleID); PlaceholderButtons2.Controls.Add(moduleSettingsButton2); PlaceHolderButtons.Controls.Add(new LiteralControl(" ")); PlaceholderButtons2.Controls.Add(new LiteralControl(" ")); cancelButton = new LinkButton(); cancelButton.CssClass = "CommandButton"; PlaceHolderButtons.Controls.Add(cancelButton); // jminond added to top of property page so no need to scroll for save LinkButton cancel2 = new LinkButton(); cancel2.CssClass = "CommandButton"; cancel2.TextKey = "Cancel"; cancel2.Text = "Cancel"; cancel2.Click += new EventHandler(CancelButton_Click); PlaceholderButtons2.Controls.Add(cancel2); // if (((Page) this.Page).IsCssFileRegistered("tabsControl") == false) // { // string themePath = Path.WebPathCombine(this.CurrentTheme.WebPath, "/tabControl.css"); // ((Page) this.Page).RegisterCssFile("tabsControl", themePath); // } if (!((Rainbow.Framework.Web.UI.Page) this.Page).IsCssFileRegistered("TabControl")) { ((Rainbow.Framework.Web.UI.Page) this.Page).RegisterCssFile("TabControl"); } this.enableWorkflowSupport.CheckedChanged += new EventHandler(this.enableWorkflowSupport_CheckedChanged); this.Load += new EventHandler(this.Page_Load); base.OnInit(e); }
/// <summary> /// On init /// </summary> /// <param name="e"></param> protected override void OnInit(EventArgs e) { this.PlaceHolderButtons.EnableViewState = false; this.PlaceholderButtons2.EnableViewState = false; //Controls must be created here updateButton = new LinkButton(); updateButton.CssClass = "CommandButton"; PlaceHolderButtons.Controls.Add(updateButton); // jminond added to top of property page so no need to scroll for save LinkButton update2 = new LinkButton(); update2.CssClass = "CommandButton"; update2.TextKey = "Apply"; update2.Text = "Apply"; update2.Click += new EventHandler(UpdateButton_Click); PlaceholderButtons2.Controls.Add(update2); // PlaceHolderButtons.Controls.Add(new LiteralControl(" ")); // PlaceholderButtons2.Controls.Add(new LiteralControl(" ")); saveAndCloseButton = new LinkButton(); saveAndCloseButton.TextKey = "SAVE_AND_CLOSE"; saveAndCloseButton.Text = "Save and close"; saveAndCloseButton.CssClass = "CommandButton"; PlaceHolderButtons.Controls.Add(saveAndCloseButton); // jminond added to top of property page so no need to scroll for save LinkButton saveAndCloseButton2 = new LinkButton(); saveAndCloseButton2.TextKey = "SAVE_AND_CLOSE"; saveAndCloseButton2.Text = "Save and close"; saveAndCloseButton2.CssClass = "CommandButton"; saveAndCloseButton2.Click += new EventHandler(this.saveAndCloseButton_Click); PlaceholderButtons2.Controls.Add(saveAndCloseButton2); this.saveAndCloseButton.Click += new EventHandler(this.saveAndCloseButton_Click); // PlaceHolderButtons.Controls.Add(new LiteralControl(" ")); // PlaceholderButtons2.Controls.Add(new LiteralControl(" ")); // Removed by Mario Endara <*****@*****.**> (2004/11/04) // if (Rainbow.Security.PortalSecurity.IsInRoles("Admins")) // { adminPropertiesButton = new HyperLink(); adminPropertiesButton.TextKey = "MODULESETTINGS_BASE_SETTINGS"; adminPropertiesButton.Text = "Edit base settings"; adminPropertiesButton.CssClass = "CommandButton"; adminPropertiesButton.NavigateUrl = HttpUrlBuilder.BuildUrl("~/DesktopModules/CoreModules/Admin/ModuleSettings.aspx", PageID, ModuleID); PlaceHolderButtons.Controls.Add(adminPropertiesButton); // jminond added to top of property page so no need to scroll for save HyperLink adminPropertiesButton2 = new HyperLink(); adminPropertiesButton2.TextKey = "MODULESETTINGS_BASE_SETTINGS"; adminPropertiesButton2.Text = "Edit base settings"; adminPropertiesButton2.CssClass = "CommandButton"; adminPropertiesButton2.NavigateUrl = HttpUrlBuilder.BuildUrl("~/DesktopModules/CoreModules/Admin/ModuleSettings.aspx", PageID, ModuleID); PlaceholderButtons2.Controls.Add(adminPropertiesButton2); // PlaceHolderButtons.Controls.Add(new LiteralControl(" ")); // PlaceholderButtons2.Controls.Add(new LiteralControl(" ")); // } // jminond added to top of property page so no need to scroll for save LinkButton cancel2 = new LinkButton(); cancel2.CssClass = "CommandButton"; cancel2.TextKey = "Cancel"; cancel2.Text = "Cancel"; cancel2.Click += new EventHandler(CancelButton_Click); PlaceholderButtons2.Controls.Add(cancel2); cancelButton = new LinkButton(); cancelButton.CssClass = "CommandButton"; PlaceHolderButtons.Controls.Add(cancelButton); // if(((UI.Page)this.Page).IsCssFileRegistered("tabsControl") == false) // { // string themePath = Path.WebPathCombine(this.CurrentTheme.WebPath, "/tabControl.css"); // ((UI.Page)this.Page).RegisterCssFile("tabsControl", themePath); // } // Modified by Hongwei Shen 10/72005-- the css file will be inject with the main theme // if(!((UI.Page)this.Page).IsCssFileRegistered("TabControl")) // ((UI.Page)this.Page).RegisterCssFile("TabControl"); this.EditTable.UpdateControl += new UpdateControlEventHandler(this.EditTable_UpdateControl); this.Load += new EventHandler(this.PagePropertyPage_Load); base.OnInit(e); }
/// <summary> /// This function traverses a given directory and finds all its nested directories and /// files. As the function encounters nested directories, it calls a new instance of /// the procedure passing the new found directory as a parameter. Files within the /// directories are nested and tabulated. /// </summary> /// <param name="path">Directory path to traverse.</param> private void parseDirectory(string path) { string[] entry; try { // Retrieve all entry (entry & directories) from the current path entry = Directory.GetFileSystemEntries(path); string contentType; int locDot = 0; // For each entry in the directory... for (int i = 0; i < entry.Length; i++) { // Trim the file path from the file, leaving the filename string filename = entry[i].Replace(path, string.Empty); // If the current entry is a directory... if (Directory.Exists(entry[i])) { // Find how many entry the subdirectory has and create an objectID name for the subdirectory int subentries = Directory.GetFileSystemEntries(entry[i]).Length; string objectID; if (entry[i].Length > 0) { objectID = entry[i].Replace(physRoot, string.Empty).Replace("\\", "~"); } else { objectID = "~"; } // Define the span that holds the opened/closed directory icon Write("<img id='" + objectID + "_img'"); if (Settings["Collapsed"].ToString().Equals("True")) { Write("src='" + treeImageDIR + "dir.gif'"); } else { Write("src='" + treeImageDIR + "dir_open.gif'"); } Write(" /> <a href=\"javascript:Toggle('" + objectID + "')\" " + // Create a hover tag that contains content details about the subdirectory. "title=\"" + subentries.ToString() + " entries found.\">" + filename + "</a>" + " <br />\n<div id='" + objectID + "' style='"); if (Settings["Collapsed"].ToString().Equals("True")) { Write("display:none;"); } else { Write("display:block;"); } if (!Settings["Indent"].ToString().Equals(string.Empty)) { Write("left:" + Settings["Indent"].ToString() + "; "); } // Call the parseDirectory for the new subdirectory. Write("POSITION: relative;'>\n"); parseDirectory(entry[i] + "\\"); Write("</div>\n"); } else // ...the current entry is a file. { locDot = filename.LastIndexOf(".") + 1; if (locDot > 0) { contentType = filename.Substring(locDot); } else { contentType = "unknown"; } // create a file icon // jminond - switched to use extensions pack if (availExtensions.ContainsKey(contentType)) { Write("<img src='" + baseImageDIR + availExtensions[contentType].ToString() + "' />"); } else { Write("<img src='" + baseImageDIR + "unknown.gif' />"); } Write(" "); if (LinkType.Equals("Network Share")) { Write("<a href='" + entry[i] + "' title='Last Write Time: " + File.GetLastWriteTime(entry[i]).ToString()); Write("' target='_" + Settings["Target"].ToString() + "'>" + filename + "</a>"); } else { // Create the link to the file. LinkButton lb = new LinkButton(); lb.Text = filename; lb.CommandArgument = entry[i]; lb.Click += new EventHandler(Download); myPlaceHolder.Controls.Add(lb); } Write(" <br />\n"); } } } catch (DirectoryNotFoundException) { Write("<span class='Error'>Error! The directory path you specified does not exist.</span>"); return; } catch (Exception e1) // All other exceptions... { Write("<span class='Error'>" + e1.ToString() + "</span>"); return; } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> private void Page_Load(object sender, EventArgs e) { test = int.Parse(Settings["Test"].ToString()); VoteDayPeriod = int.Parse(Settings["VoteDayPeriod"].ToString()); // Creation of the Survey - Begin // It uses cookies to find out whether the user has already done it string CookieName = "Survey" + ModuleID.ToString(); if (test == 1) { CookieName += "Test"; } if (Request.Cookies[CookieName] == null) { // Finds the dimension of the arrays SurveyDB DimArray = new SurveyDB(); int DimArrRadio = DimArray.GetDimArray(ModuleID, "RD"); DimArrRadio = DimArrRadio + 1; int DimArrCheck = DimArray.GetDimArray(ModuleID, "CH"); DimArrCheck = DimArrCheck + 1; // Declaration of the ARRAYS Array ArrRadioButton = Array.CreateInstance(typeof(Int32), DimArrRadio); Array ArrCheckButton = Array.CreateInstance(typeof(Int32), DimArrCheck); Array arrRadioQuestionID = Array.CreateInstance(typeof(Int32), DimArrRadio); Array arrRadioOptionID = Array.CreateInstance(typeof(Int32), DimArrRadio); Array arrCheckQuestionID = Array.CreateInstance(typeof(Int32), DimArrCheck); Array arrCheckOptionID = Array.CreateInstance(typeof(Int32), DimArrCheck); // Indexes of the Arrays int i = 0; int j = 0; int ControlIndex = 0; if (SurveyHolder.Controls.Count > 0) { ControlIndex = SurveyHolder.Controls.Count; } SurveyDB Questions = new SurveyDB(); SqlDataReader result = Questions.GetQuestions(ModuleID); bool FirstTime = true; int GroupQuestionPrev = 0; bool GetSurveyID = true; try { while (result.Read()) // Reads the list one-by-one { if (GetSurveyID) { ViewState["SurveyID"] = (int)result["SurveyID"]; GetSurveyID = false; } if (!FirstTime) { if (GroupQuestionPrev != (int)result["QuestionID"]) { Label lbl = new Label(); lbl.Visible = true; lbl.Text = "<br />" + result["Question"].ToString(); lbl.CssClass = "SurveyQuestion"; SurveyHolder.Controls.Add(lbl); ControlIndex = ControlIndex + 1; SurveyHolder.Controls.Add(new LiteralControl("<br /><br />")); ControlIndex = ControlIndex + 1; GroupQuestionPrev = (int)result["QuestionID"]; } } else { Label lbl = new Label(); lbl.Visible = true; lbl.Text = "<br />" + result["Question"].ToString(); lbl.CssClass = "SurveyQuestion"; SurveyHolder.Controls.Add(lbl); ControlIndex = ControlIndex + 1; SurveyHolder.Controls.Add(new LiteralControl("<br /><br />")); ControlIndex = ControlIndex + 1; GroupQuestionPrev = (int)result["QuestionID"]; FirstTime = false; } // Finds the Type of Option if (result["TypeOption"].ToString() == "RD") { i++; RadioButton RdButton = new RadioButton(); RdButton.ID = "RdButton_" + i.ToString(); RdButton.GroupName = "Option_" + GroupQuestionPrev.ToString(); RdButton.Text = result["OptionDesc"].ToString(); RdButton.CssClass = "SurveyOption"; SurveyHolder.Controls.Add(RdButton); ControlIndex = ControlIndex + 1; // Save RadioButton position ArrRadioButton.SetValue(ControlIndex, i); arrRadioQuestionID.SetValue((int)result["QuestionID"], i); arrRadioOptionID.SetValue((int)result["OptionID"], i); // Adds a Literal SurveyHolder.Controls.Add(new LiteralControl("<br>")); ControlIndex = ControlIndex + 1; } else { j++; ; CheckBox ChButton = new CheckBox(); ChButton.ID = "ChButton_" + j.ToString(); ChButton.Text = result["OptionDesc"].ToString(); ChButton.CssClass = "SurveyOption"; SurveyHolder.Controls.Add(ChButton); ControlIndex++; // Saves Checkbox position ArrCheckButton.SetValue(ControlIndex, j); arrCheckQuestionID.SetValue((int)result["QuestionID"], j); arrCheckOptionID.SetValue((int)result["OptionID"], j); // Adds a literal SurveyHolder.Controls.Add(new LiteralControl("<br>")); ControlIndex++; } } } finally { result.Close(); //by Manu, fixed bug 807858 } // Checks whether the Survey exist SurveyDB SurveyCheck = new SurveyDB(); int RowCount = 0; RowCount = SurveyCheck.ExistSurvey(ModuleID); if (RowCount > 0) { SurveyHolder.Controls.Add(new LiteralControl("<br />")); ControlIndex = ControlIndex + 1; SubmitButton = new LinkButton(); SubmitButton.ID = "Submit"; SubmitButton.Text = General.GetString("SURVEY_SUBMIT", "Submit", this); SubmitButton.CssClass = "SurveyButton"; SurveyHolder.Controls.Add(SubmitButton); SubmitButton.Click += new EventHandler(SubmitButton_Click); } ViewState["arrRadioButton"] = ArrRadioButton; ViewState["arrRadioQuestionID"] = arrRadioQuestionID; ViewState["arrRadioOptionID"] = arrRadioOptionID; ViewState["MaxRdIndex"] = i; ViewState["arrCheckButton"] = ArrCheckButton; ViewState["arrCheckQuestionID"] = arrCheckQuestionID; ViewState["arrCheckOptionID"] = arrCheckOptionID; ViewState["MaxChIndex"] = j; ViewState["URL"] = Request.Url.AbsoluteUri; } else { // Creation of Chart Survey - Begin int SurveyID = int.Parse(Request.Cookies[CookieName].Value); SurveyDB Answers = new SurveyDB(); SqlDataReader result = Answers.GetAnswers(SurveyID); bool FirstTime = true; int GroupQuestionPrev = 0; int tot = 0; float perc; try { while (result.Read()) // Reads the list one-by-one { if (!FirstTime) // Shows the Question { if (GroupQuestionPrev != (int)result["QuestionID"]) { Label lbl = new Label(); lbl.Visible = true; lbl.Text = result["Question"].ToString(); lbl.CssClass = "SurveyQuestion"; SurveyHolder.Controls.Add(lbl); SurveyHolder.Controls.Add(new LiteralControl("<br /><br />")); GroupQuestionPrev = (int)result["QuestionID"]; tot = GetTotAnswer(SurveyID, GroupQuestionPrev); // get the tot } } else { Label lbl = new Label(); lbl.Visible = true; lbl.Text = result["Question"].ToString(); lbl.CssClass = "SurveyQuestion"; SurveyHolder.Controls.Add(lbl); SurveyHolder.Controls.Add(new LiteralControl("<br /><br />")); GroupQuestionPrev = (int)result["QuestionID"]; FirstTime = false; tot = GetTotAnswer(SurveyID, GroupQuestionPrev); } if (tot == 0) { perc = 0; } else { perc = (float.Parse(result["Num"].ToString()) / (float)tot) * 100; } // Shows the AnswerOptions Panel Pan = new Panel(); Pan.CssClass = "SurveyPanel"; Pan.Visible = true; Pan.Width = Unit.Percentage(perc); SurveyHolder.Controls.Add(Pan); Label lblOptDesc = new Label(); lblOptDesc.Visible = true; lblOptDesc.Text = result["OptionDesc"].ToString() + " " + perc.ToString("0") + "% " + result["Num"].ToString() + " " + General.GetString("SURVEY_VOTES", "votes", this) + "<br />"; lblOptDesc.CssClass = "SurveyOption"; SurveyHolder.Controls.Add(lblOptDesc); SurveyHolder.Controls.Add(new LiteralControl("<br />")); } } finally { result.Close(); //by Manu, fixed bug 807858 } } }
/// <summary> /// DisplayImages /// </summary> public void DisplayImages() { _returnPath = "~~/" + ((SettingItem)moduleSettings["FlashPath"]).Value; string[] galleryfolderarray = ReturnFolderContentArray(); flashTable.Controls.Clear(); if (galleryfolderarray == null || galleryfolderarray.Length == 0) { gallerymessage.Text = _noImagesMessage; } else { string galleryfilename = (string.Empty); TableRow rowItem; TableCell cellItemImage; TableCell cellItemSelect; TableCell cellItemDelete; TableCell cellItemFileName; foreach (string galleryfolderarrayitem in galleryfolderarray) { galleryfilename = galleryfolderarrayitem.ToString(); galleryfilename = galleryfilename.Substring(galleryfilename.LastIndexOf(@"\") + 1); FlashMovie flashMovie = new FlashMovie(); flashMovie.MovieName = _imageFolder + "/" + galleryfilename; flashMovie.MovieHeight = "150px"; flashMovie.MovieWidth = "150px"; Label filenameLbl = new Label(); filenameLbl.Text = galleryfilename; HyperLink selectCmd = new HyperLink(); selectCmd.TextKey = "SELECT"; selectCmd.Text = "Select"; //by yiming selectCmd.CssClass = "CommandButton"; selectCmd.NavigateUrl = "javascript:UpdateOpener('" + _returnPath + "/" + galleryfilename + "');self.close();"; LinkButton deleteCmd = new LinkButton(); deleteCmd.TextKey = "DELETE"; deleteCmd.Text = "Delete"; deleteCmd.CommandName = "DELETE"; deleteCmd.CssClass = "CommandButton"; deleteCmd.CommandArgument = galleryfilename; deleteCmd.Command += new CommandEventHandler(Delete_Command); rowItem = new TableRow(); cellItemImage = new TableCell(); cellItemSelect = new TableCell(); cellItemDelete = new TableCell(); cellItemFileName = new TableCell(); cellItemImage.Controls.Add(flashMovie); cellItemFileName.Controls.Add(filenameLbl); cellItemSelect.Controls.Add(selectCmd); cellItemDelete.Controls.Add(deleteCmd); rowItem.Controls.Add(cellItemImage); rowItem.Controls.Add(cellItemFileName); rowItem.Controls.Add(cellItemSelect); rowItem.Controls.Add(cellItemDelete); flashTable.Controls.Add(rowItem); gallerymessage.Text = string.Empty; } } }