public override string GetDesignTimeHtml()
		{
			StringWriter sw = new StringWriter();
			HtmlTextWriter writer = new HtmlTextWriter(sw);

			Panel panel = new Panel();
			panel.BackColor = Color.WhiteSmoke;
			panel.Width = new Unit("100%");

			HtmlTable table = new HtmlTable();
			table.Attributes["align"] = "center";
			HtmlTableRow row = new HtmlTableRow();

			HtmlTableCell cell1 = new HtmlTableCell();
			cell1.Align = "left";
			cell1.VAlign = "middle";

			HtmlImage castleImg = new HtmlImage();
			castleImg.Style["margin"] = "4px";
			castleImg.Src = binder.Page.ClientScript.GetWebResourceUrl(
				GetType(), "Castle.MonoRail.Framework.Views.Aspx.ControllerBinder.Design.Castle.gif");
			cell1.Controls.Add(castleImg);
			row.Cells.Add(cell1);

			HtmlTableCell cell2 = new HtmlTableCell();
			cell1.Align = "left";
			cell1.VAlign = "middle";

			HtmlImage monoRailImg = new HtmlImage();
			monoRailImg.Src = binder.Page.ClientScript.GetWebResourceUrl(
				GetType(), "Castle.MonoRail.Framework.Views.Aspx.ControllerBinder.Design.MonoRail.gif");
			cell2.Controls.Add(monoRailImg);
			row.Cells.Add(cell2);

			HtmlTableCell cell3 = new HtmlTableCell();
			cell3.Align = "center";
			cell3.VAlign = "middle";
			cell3.Attributes["style"] = "font-family: verdana, tahoma, arial, sans-serif; font-size: 0.9em; color:#5266A6";
			LiteralControl caption = new LiteralControl();
			int bindingCount = binder.ControllerBindings.Count;
			caption.Text = string.Format("<b>Controller Binder</b> - {0} binding{1}",
				bindingCount, bindingCount != 1 ? "s" : "");
			cell3.Controls.Add(caption);
			row.Cells.Add(cell3);

			table.Rows.Add(row);

			panel.Controls.Add(table);

			// Get the HTML produced by the control.
			panel.RenderControl(writer);
			return sw.ToString();
		}
Ejemplo n.º 2
0
 private static string ConvertPanelToHTML(Panel panel)
 {
     StringWriter writer = new StringWriter();
     HtmlTextWriter writer2 = new HtmlTextWriter(writer);
     panel.RenderControl(writer2);
     return writer.ToString();
 }
 protected override void RenderContents(
     HtmlTextWriter writer)
 {
     if (DesignMode)
     {
         Panel p = new Panel();
         p.Width = 20;
         p.GroupingText = this.ID;
         p.RenderControl(writer);
     }
 }
Ejemplo n.º 4
0
		/// <summary>
		/// Used internally when DbCombo is in Visual Studio .NET design-time mode
		/// </summary>
		/// <returns>n/a</returns>
		public override	string GetDesignTimeHtml()
		{
			try
			{
				if (MyDbCombo.Height.Value!=previousHeight || MyDbCombo.Width.Value!=previousWidth)
				{
					//mod height and width
					int proposedCols = 30;
					if (MyDbCombo.Width.Value>0)
						proposedCols = (int)Math.Floor((MyDbCombo.Width.Value - 14)/6.0);
					MyDbCombo.TextBoxColumns=proposedCols>1?proposedCols:1;

					int proposedRows = 10;
					if (MyDbCombo.Height.Value>0)
						proposedRows = (int)Math.Floor((MyDbCombo.Height.Value - 75)/16.0);
					MyDbCombo.DropDownRows=proposedRows>2?proposedRows:2;

					previousHeight=(int)MyDbCombo.Height.Value;
					previousWidth=(int)MyDbCombo.Width.Value;

				}

				this.IsDirty=true;
				
				StartAsync(MyDbCombo);

				Panel p = new Panel();
				p.Controls.Add(MyDbCombo);
				StringWriter t = new StringWriter();
				HtmlTextWriter w = new HtmlTextWriter(t);
				p.RenderControl(w);
				return t.ToString();
			}
			catch (Exception e)
			{
				return GetErrorDesignTimeHtml(e);
			}
		}
Ejemplo n.º 5
0
        /// <summary>
        /// Renders the base control.
        /// </summary>
        /// <param name="writer">The writer.</param>
        public void RenderBaseControl( HtmlTextWriter writer )
        {
            // set display on render (vs waiting for the javascript to do it after the page is loaded)
            bool isLast = _ddlLastCurrent.SelectedValue == "0";
            bool isCurrent = _ddlLastCurrent.SelectedValue == "1";
            bool isDateRange = _ddlLastCurrent.SelectedValue == "2";
            bool isPrevious = _ddlLastCurrent.SelectedValue == "4";
            _nbNumber.Style[HtmlTextWriterStyle.Display] = ( isLast|| isPrevious ) ? "block" : "none";
            _ddlTimeUnitTypeSingular.Style[HtmlTextWriterStyle.Display] = ( isCurrent ) ? "block" : "none";
            _ddlTimeUnitTypePlural.Style[HtmlTextWriterStyle.Display] = ( isLast || isPrevious ) ? "block" : "none";
            _drpDateRange.Style[HtmlTextWriterStyle.Display] = ( isDateRange ) ? "block" : "none";

            bool needsAutoPostBack = SelectedDateRangeChanged != null;
            _ddlLastCurrent.AutoPostBack = needsAutoPostBack;
            _ddlTimeUnitTypeSingular.AutoPostBack = needsAutoPostBack;
            _ddlTimeUnitTypePlural.AutoPostBack = needsAutoPostBack;

            // render a div that will get its text from ~api/Utility/CalculateSlidingDateRange (see slidingDateRangePicker.js)
            Panel dateRangePreviewDiv = new Panel();
            dateRangePreviewDiv.CssClass = "label label-info js-slidingdaterange-info slidingdaterange-info";

            if ( this.PreviewLocation == SlidingDateRangePicker.DateRangePreviewLocation.Top )
            {
                writer.WriteLine();
                dateRangePreviewDiv.RenderControl( writer );
            }

            // render a hidden element that will get its text from ~api/Utility/GetSlidingDateRangeTextValue (see slidingDateRangePicker.js)
            writer.AddAttribute( "type", "hidden" );
            writer.AddAttribute( "class", "js-slidingdaterange-text-value" );
            writer.RenderBeginTag( HtmlTextWriterTag.Input );
            writer.RenderEndTag();

            writer.AddAttribute( "id", this.ClientID );
            writer.AddAttribute( "class", "form-control-group" );
            writer.RenderBeginTag( HtmlTextWriterTag.Div );

            _ddlLastCurrent.RenderControl( writer );
            _nbNumber.RenderControl( writer );
            _ddlTimeUnitTypeSingular.RenderControl( writer );
            _ddlTimeUnitTypePlural.RenderControl( writer );
            _drpDateRange.RenderControl( writer );

            if ( this.PreviewLocation == SlidingDateRangePicker.DateRangePreviewLocation.Right )
            {
                writer.WriteLine();
                dateRangePreviewDiv.RenderControl( writer );
            }

            writer.RenderEndTag();

            RegisterJavaScript();
        }
Ejemplo n.º 6
0
 protected override void Render(HtmlTextWriter OutPut)
 {
     base.Render(OutPut);
      if (this.Items.Count > 0)
      {
     Panel panel1 = new Panel();
     panel1.Attributes.Add("style", "cursor:hand;");
     WebControl control1 = panel1;
     TreeView view1 = this;
     int num1 = 0;
     this.Items.Render(ref control1, ref view1, 0, ref num1, "");
     panel1 = (Panel) control1;
     panel1.Attributes.Add("style", this.Attributes["style"]);
     panel1.BorderColor = this.BorderColor;
     panel1.BorderWidth = this.BorderWidth;
     panel1.BorderStyle = this.BorderStyle;
     panel1.BackColor = this.BackColor;
     panel1.Width = this.Width;
     panel1.Height = this.Height;
     panel1.RenderControl(OutPut);
      }
      else
      {
     OutPut.Write("[TreeView - No items]");
      }
 }
Ejemplo n.º 7
0
        public static void TOExcel(HttpResponse Response, Control grid, string FileName)
        {
            bool VisibleFlag = false;

            Response.Clear();
            Response.AddHeader("content-disposition", string.Format("attachment;filename={0}", FileName));
            Response.ContentEncoding = Encoding.UTF8;
            Response.Charset = "";

            // If you want the option to open the Excel file without saving than
            // comment out the line below
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = "excel/ms-excel";// "application/vnd.ms-excel";
            StringWriter stringWrite = new StringWriter();
            HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);

            //save State
            //Control ctrl_Parent = null;
            //if (grid.Parent != null)
            //{
            //    ctrl_Parent = grid.Parent;
            //    ctrl_Parent.Controls.Remove(grid);
            //}
            if (!grid.Visible)
            {
                grid.Visible = true;
                VisibleFlag = true;
            }
            ////////////////////////////////
            Panel pnl = new Panel();
            pnl.Controls.Add(grid);
            pnl.Direction = ContentDirection.RightToLeft;
            pnl.RenderControl(htmlWrite);

            Response.Write(stringWrite.ToString());
            Response.Flush();
            Response.End();

            //////restore State////////////////////////////////////////////Z//

            //if (ctrl_Parent != null)
            //    ctrl_Parent.Controls.Add(grid.Parent);

            if (VisibleFlag)
                grid.Visible = false;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 将此控件呈现给指定的输出参数,并使用指定的数据初始化控件。
        /// </summary>
        /// <param name="writer"> 接收控件内容的 HtmlTextWriter 编写器 </param>
        /// <param name="MenuXML">菜单文件名。</param>
        public void RenderControl(HtmlTextWriter writer, string MenuXML)
        {
            Thinksea.WebControls.Menu2.Menu menuConnection = new Thinksea.WebControls.Menu2.Menu(MenuXML); // 菜单数据库联接。

            string OutMenuHtmlText =                                                                       // 输出菜单 HTML 文本。
                                     @"<script type='text/javascript' id='clientEventHandlersJS'>
<!--
function Thinksea_WebControls_Menu2_menuChange_" + this.ID + @"(obj,menu)
{
	var controls = document.getElementById('"     + this.ID + @"').all;
	for (var i=0; i < controls.length; i++)
	{
		if( controls[i].id == menu )
		{
			menu = controls[i];
		}
	}
	if(menu.style.display=='')
	{"    ;

            if (this.MenuTitleCollapseStyle != null)
            {
                if (this.MenuTitleCollapseStyle.CssClass != null && this.MenuTitleCollapseStyle.CssClass != "")
                {
                    OutMenuHtmlText = OutMenuHtmlText + @"
		obj.className='"         + this.MenuTitleCollapseStyle.CssClass + @"';";
                }
                string styleStr = this.StyleToCssString(this.MenuTitleCollapseStyle);
                if (styleStr != "")
                {
                    OutMenuHtmlText = OutMenuHtmlText + @"
		obj.style.cssText='"         + styleStr + @"';";
                }
            }
            OutMenuHtmlText += @"
		menu.style.display='none';
	}else{"    ;
            if (this.MenuTitleStyle != null)
            {
                if (this.MenuTitleStyle.CssClass != null && this.MenuTitleStyle.CssClass != "")
                {
                    OutMenuHtmlText = OutMenuHtmlText + @"
		obj.className='"         + this.MenuTitleStyle.CssClass + @"';";
                }
                string styleStr = this.StyleToCssString(this.MenuTitleStyle);
                if (styleStr != "")
                {
                    OutMenuHtmlText = OutMenuHtmlText + @"
		obj.style.cssText='"         + styleStr + @"';";
                }
            }
            OutMenuHtmlText += @"
		menu.style.display='';
	}
}
//-->
		</script>"        ;

            System.Web.UI.WebControls.Panel MenuPanel = new System.Web.UI.WebControls.Panel();
            MenuPanel.ID = this.ID;
            if (this.Style["Z-INDEX"] != null)
            {
                MenuPanel.Style["Z-INDEX"] = this.Style["Z-INDEX"];
            }
            if (this.Style["POSITION"] != null)
            {
                MenuPanel.Style["POSITION"] = this.Style["POSITION"];
            }
            if (this.Style["LEFT"] != null)
            {
                MenuPanel.Style["LEFT"] = this.Style["LEFT"];
            }
            if (this.Style["TOP"] != null)
            {
                MenuPanel.Style["TOP"] = this.Style["TOP"];
            }
            MenuPanel.ApplyStyle(this.ControlStyle);
            MenuPanel.Enabled = this.Enabled;
            MenuPanel.Visible = this.Visible;

            int menuGroupCount = 0;       //菜单组数量
            int menuItemCount;            //菜单组中菜单项数量

            Thinksea.WebControls.Menu2.MenuGroup [] mgis = menuConnection.GetMenuGroup( );
            foreach (Thinksea.WebControls.Menu2.MenuGroup tmpmgis in mgis)
            {
                Thinksea.WebControls.Menu2.MenuItem [] miis = menuConnection.GetMenuItemOfMenuGroupIDWithAccessFilter(tmpmgis.ID, this.Powers);
                if (miis.Length > 0)
                {
                    menuItemCount = 0;

                    #region 菜单集合。
                    System.Web.UI.WebControls.Table MenuGroup = new System.Web.UI.WebControls.Table();
                    MenuGroup.Width       = new System.Web.UI.WebControls.Unit("100%");
                    MenuGroup.CellSpacing = 0;
                    MenuGroup.CellPadding = 0;

                    #region 菜单组标题
                    System.Web.UI.WebControls.TableRow MenuGroupTitleRow = new System.Web.UI.WebControls.TableRow();
                    MenuGroupTitleRow.Style["CURSOR"] = "hand";
                    #region
                    System.Web.UI.WebControls.TableCell MenuGroupTitleCell = new System.Web.UI.WebControls.TableCell();
                    if (tmpmgis.Expand)
                    {
                        MenuGroupTitleCell.ApplyStyle(this.MenuTitleStyle);
                    }
                    else
                    {
                        MenuGroupTitleCell.ApplyStyle(this.MenuTitleCollapseStyle);
                    }
                    MenuGroupTitleCell.Attributes["onclick"] = "Thinksea_WebControls_Menu2_menuChange_" + this.ID + "(this,'" + tmpmgis.ID.Replace("\"", "\\\"") + "');";

                    #region 填充菜单组标题
                    System.Web.UI.WebControls.Label TitleText = new System.Web.UI.WebControls.Label();
                    TitleText.ApplyStyle(this.MenuTitleOnMouseOutStyle);
                    if (this.MenuTitleOnMouseOverStyle != null)
                    {
                        string styleStr = this.StyleToCssString(this.MenuTitleOnMouseOverStyle);
                        if (styleStr != "")
                        {
                            TitleText.Attributes["onmouseover"] = "this.style.cssText='" + styleStr + "';";
                        }
                        else
                        {
                            if (this.MenuTitleOnMouseOverStyle.CssClass != null && this.MenuTitleOnMouseOverStyle.CssClass != "")
                            {
                                TitleText.Attributes["onmouseover"] = "this.className='" + this.MenuTitleOnMouseOverStyle.CssClass + "';";
                            }
                        }
                    }
                    if (this.MenuTitleOnMouseOutStyle != null)
                    {
                        string styleStr = this.StyleToCssString(this.MenuTitleOnMouseOutStyle);
                        if (styleStr != "")
                        {
                            TitleText.Attributes["onmouseout"] = "this.style.cssText='" + styleStr + "';";
                        }
                        else
                        {
                            if (this.MenuTitleOnMouseOutStyle.CssClass != null && this.MenuTitleOnMouseOutStyle.CssClass != "")
                            {
                                TitleText.Attributes["onmouseout"] = "this.className='" + this.MenuTitleOnMouseOutStyle.CssClass + "';";
                            }
                        }
                    }
                    TitleText.Text = tmpmgis.Text;

                    MenuGroupTitleCell.Controls.Add(TitleText);
                    #endregion

                    MenuGroupTitleRow.Cells.Add(MenuGroupTitleCell);
                    #endregion
                    MenuGroup.Rows.Add(MenuGroupTitleRow);
                    #endregion

                    #region 菜单项集合。
                    System.Web.UI.WebControls.TableRow MenuGroupRow = new System.Web.UI.WebControls.TableRow();
                    #region
                    System.Web.UI.WebControls.TableCell MenuGroupCell = new System.Web.UI.WebControls.TableCell();

                    #region
                    System.Web.UI.WebControls.Panel MenuGroupPanel = new System.Web.UI.WebControls.Panel();
                    MenuGroupPanel.ApplyStyle(this.MenuGroupStyle);
                    MenuGroupPanel.ID = tmpmgis.ID;
                    if (!tmpmgis.Expand)
                    {
                        MenuGroupPanel.Style["DISPLAY"] = "none";
                    }

                    #region 填充菜单项
                    int CellMaxCount = this.MaxColumn;    //用来控制每行最多显示的菜单项数量
                    int CellIndex    = 0;                 //当前显示的菜单项行索引。用来辅助CellMaxCount完成控制每行显示的菜单项数量
                    foreach (Thinksea.WebControls.Menu2.MenuItem tmpmiis in miis)
                    {
                        #region 插入菜单项分隔符
                        if (this.ShowMenuItemSeparator && CellIndex > 0)
                        {
                            System.Web.UI.WebControls.Label menuItemSeparator = new System.Web.UI.WebControls.Label();
                            menuItemSeparator.ApplyStyle(this.MenuItemSeparatorStyle);
                            MenuGroupPanel.Controls.Add(menuItemSeparator);
                        }
                        #endregion

                        #region 菜单项
                        System.Web.UI.WebControls.HyperLink MenuItem = new System.Web.UI.WebControls.HyperLink();
                        MenuItem.ApplyStyle(this.MenuItemStyle);
                        MenuItem.ID   = tmpmiis.ID;
                        MenuItem.Text = tmpmiis.Text;
                        if (this.Enabled)
                        {
                            if (tmpmiis.URL.Length == 0)
                            {
                                MenuItem.NavigateUrl = "javascript:" + this.Page.ClientScript.GetPostBackEventReference(this, "ItemID_" + tmpmiis.ID);
                            }
                            else
                            {
                                MenuItem.Target      = tmpmiis.Target;
                                MenuItem.NavigateUrl = tmpmiis.URL;
                            }
                            if (this.ItemDataBound != null)
                            {
                                this.ItemDataBound(this, new Thinksea.WebControls.Menu2.ItemEventArgs(MenuItem, tmpmiis));
                            }
                        }

                        MenuGroupPanel.Controls.Add(MenuItem);
                        #endregion

                        menuItemCount++;
                        CellIndex++;
                        if (CellIndex >= CellMaxCount)
                        {
                            CellIndex = 0;
                            System.Web.UI.WebControls.Literal MenuItemSplit = new System.Web.UI.WebControls.Literal();
                            MenuItemSplit.Text = "<br>";
                            MenuGroupPanel.Controls.Add(MenuItemSplit);
                        }
                    }
                    #endregion

                    MenuGroupCell.Controls.Add(MenuGroupPanel);
                    #endregion

                    MenuGroupRow.Cells.Add(MenuGroupCell);
                    #endregion
                    MenuGroup.Rows.Add(MenuGroupRow);
                    #endregion

                    if (menuItemCount > 0)
                    {
                        if (this.ShowMenuGroupSeparator && menuGroupCount > 0)
                        {
                            System.Web.UI.WebControls.Panel menuGroupSeparator = new System.Web.UI.WebControls.Panel();
                            menuGroupSeparator.ApplyStyle(this.MenuGroupSeparatorStyle);
                            MenuPanel.Controls.Add(menuGroupSeparator);
                        }
                        MenuPanel.Controls.Add(MenuGroup);
                        menuGroupCount++;
                    }
                    #endregion
                }
            }
            writer.Write(OutMenuHtmlText);
            MenuPanel.RenderControl(writer);
        }
 // The contacts are rendered in an HTML table.
 protected override void RenderContents(
     HtmlTextWriter writer)
 {
     if (DesignMode)
     {
         Panel p = new Panel();
         p.Width = 20;
         p.GroupingText = this.ID;
         p.RenderControl(writer);
         //Table t = CreateContactsTable();
         //if (t != null)
         //{
         //    t.RenderControl(writer);
         //}
     }
 }
Ejemplo n.º 10
0
        public static string GenerateTravelPopup(string projectID, string projectType)
        {
            // StringBuilder we'll be writing HTML to!
            StringBuilder aStringBuilder = new StringBuilder();
            // We'll render the Panels/Buttons/etc to this, which directs it to the StringBuilder above.
            HtmlTextWriter aHTMLTextWriter = new HtmlTextWriter(new System.IO.StringWriter(aStringBuilder));

            Panel aDialogPopup = new Panel();
            Panel aDialogContent = new Panel();

            // TEST TIME
            aDialogPopup.ID = "projectTransitBackground";
            aDialogPopup.CssClass = "projectTransitOverlay";
            aDialogPopup.Attributes["style"] = "display: none;";

            aDialogContent.CssClass = "content";
            aDialogPopup.Controls.Add(aDialogContent);

            //
            Label aPopupDescription = new Label();

            aPopupDescription.Text = "Please select the following options:";

            // Close box
            Panel aCloseBar = new Panel();

            aCloseBar.CssClass = "closeBar";

            aDialogContent.Controls.Add(aCloseBar);

            Panel aCloseButton = new Panel();

            aCloseButton.CssClass = "overlayClose close";

            Label aCloseLabel = new Label();

            aCloseLabel.Text = "CLOSE";

            aCloseButton.Controls.Add(aCloseLabel);

            aCloseBar.Controls.Add(aCloseButton);

            // Create session for project editor
            try
            {
                HttpContext.Current.Session.Add("project_id", projectID);
            }
            catch (Exception ex)
            {
                HttpContext.Current.Session["project_id"] = projectID;
            }

            Label aDirectionLabel = new Label();
            aDirectionLabel.Attributes["style"] = "margin-left: 25%";

            aDirectionLabel.Text = "\tPlease select one of the options: <br/><br/>";

            aDialogContent.Controls.Add(aDirectionLabel);

            Panel aProjectEditorButton = new Panel();
            Label aProjectEditorLabel = new Label();
            aProjectEditorLabel.Text = "Project Editor";
            aProjectEditorButton.ID = "btnProjectEditor";
            aProjectEditorButton.CssClass = "button";
            aProjectEditorButton.Attributes["style"] = "float:left;";
            aProjectEditorButton.Attributes["onClick"] = "window.location.replace(\"ProjectEditor.aspx\"); return false;";
            aProjectEditorButton.Controls.Add(aProjectEditorLabel);
            aDialogContent.Controls.Add(aProjectEditorButton);

            Panel aPriceCalculatorButton = new Panel();
            Label aPriceCalculatorLabel = new Label();
            aPriceCalculatorLabel.Text = "Price Calculator";
            aPriceCalculatorButton.ID = "btnPriceCalculator";
            aPriceCalculatorButton.CssClass = "button";
            aPriceCalculatorButton.Attributes["style"] = "float:right;";
            aPriceCalculatorButton.Attributes["onClick"] = "window.location.replace(\"PriceCalculator.aspx\"); return false;";
            aPriceCalculatorButton.Controls.Add(aPriceCalculatorLabel);
            aDialogContent.Controls.Add(aPriceCalculatorButton);

            Label LineBreaaaaak = new Label();
            LineBreaaaaak.Text = "<p>&nbsp;</p><br/><br/>";

            aDialogContent.Controls.Add(LineBreaaaaak);

            Panel aDuplicateButton = new Panel();
            Label aDuplicateLabel = new Label();
            aDuplicateLabel.Text = "Duplicate Project";
            aDuplicateButton.ID = "btnDuplicateProjectInitial";
            aDuplicateButton.CssClass = "button";
            aDuplicateButton.Attributes["style"] = "float:right;";

            aDuplicateButton.Attributes["onClick"] = "$(document).trigger( \"DuplicateProject_Click\", [ \"" + projectID + "\", \"" + projectType + "\" ] ); return false;";
            aDuplicateButton.Controls.Add(aDuplicateLabel);
            aDialogContent.Controls.Add(aDuplicateButton);

            // Render to HTMLTextWriter (so we can return StringBuilder..)
            aDialogPopup.RenderControl(aHTMLTextWriter);

            #if DEBUG // Only compile this code if you're compiling for debug.
            Debug.WriteLine(aStringBuilder.ToString());

            Debug.WriteLine(projectType);
            #endif
            return aStringBuilder.ToString();
        }
Ejemplo n.º 11
0
        public static string GenerateDuplicatePopup(string projectID, string projectType)
        {
            // StringBuilder we'll be writing HTML to!
            StringBuilder aStringBuilder = new StringBuilder();
            // We'll render the Panels/Buttons/etc to this, which directs it to the StringBuilder above.
            HtmlTextWriter aHTMLTextWriter = new HtmlTextWriter(new System.IO.StringWriter(aStringBuilder));

            Panel aDialogPopup = new Panel();
            Panel aDialogContent = new Panel();

            aDialogPopup.ID = "projectTransitBackground";
            aDialogPopup.CssClass = "projectTransitOverlay";
            aDialogPopup.Attributes["style"] = "display: none;";

            aDialogContent.CssClass = "content";
            aDialogPopup.Controls.Add(aDialogContent);

            //
            Label aPopupDescription = new Label();

            aPopupDescription.Text = "Please select dupe dis:";

            // Close box
            Panel aCloseBar = new Panel();

            aCloseBar.CssClass = "closeBar";

            aDialogContent.Controls.Add(aCloseBar);

            Panel aCloseButton = new Panel();

            aCloseButton.CssClass = "overlayClose close";

            Label aCloseLabel = new Label();

            aCloseLabel.Text = "CLOSE";

            aCloseButton.Controls.Add(aCloseLabel);

            aCloseBar.Controls.Add(aCloseButton);

            // Create session for project editor
            HttpContext.Current.Session["project_id"] = projectID;

            Label aDirectionLabel = new Label();
            aDirectionLabel.Attributes["style"] = "margin-left: 25%";

            aDirectionLabel.Text = "\tPlease rename your new project: <br/><br/>";

            aDialogContent.Controls.Add(aDirectionLabel);

            TextBox aProjectNameBox = new TextBox();
            aProjectNameBox.Attributes["placeholder"] = "Enter a project name";
            aProjectNameBox.CssClass = "txtField";

            aDialogContent.Controls.Add(aProjectNameBox);

            Panel aDuplicateButton = new Panel();
            Label aDuplicateLabel = new Label();
            aDuplicateLabel.Text = "Duplicate Project";
            aDuplicateButton.ID = "btnDuplicateProject";
            aDuplicateButton.CssClass = "button";
            aDuplicateButton.Attributes["style"] = "float:right;";
            aDuplicateButton.Attributes["onClick"] = "ActuallyDuplicateProject_Click(" + projectID + " ); return false;";
            aDuplicateButton.Controls.Add(aDuplicateLabel);
            aDialogContent.Controls.Add(aDuplicateButton);

            // Render to HTMLTextWriter (so we can return StringBuilder..)
            aDialogPopup.RenderControl(aHTMLTextWriter);

            #if DEBUG // Only compile this code if you're compiling for debug.
            Debug.WriteLine(aStringBuilder.ToString());

            Debug.WriteLine(projectType);
            #endif
            return aStringBuilder.ToString();
        }