本文整理汇总了C#中System.Web.UI.WebControls.Panel.RenderControl方法的典型用法代码示例。如果您正苦于以下问题:C# Panel.RenderControl方法的具体用法?C# Panel.RenderControl怎么用?C# Panel.RenderControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.Panel
的用法示例。
在下文中一共展示了Panel.RenderControl方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDesignTimeHtml
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();
}
示例2: ConvertPanelToHTML
private static string ConvertPanelToHTML(Panel panel)
{
StringWriter writer = new StringWriter();
HtmlTextWriter writer2 = new HtmlTextWriter(writer);
panel.RenderControl(writer2);
return writer.ToString();
}
示例3: RenderContents
protected override void RenderContents(
HtmlTextWriter writer)
{
if (DesignMode)
{
Panel p = new Panel();
p.Width = 20;
p.GroupingText = this.ID;
p.RenderControl(writer);
}
}
示例4: GetDesignTimeHtml
/// <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);
}
}
示例5: Render
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]");
}
}
示例6: TOExcel
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;
}
示例7: GenerateTravelPopup
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> </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());
//.........这里部分代码省略.........
示例8: GenerateDuplicatePopup
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();
}