本文整理汇总了C#中Panel.RenderControl方法的典型用法代码示例。如果您正苦于以下问题:C# Panel.RenderControl方法的具体用法?C# Panel.RenderControl怎么用?C# Panel.RenderControl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Panel
的用法示例。
在下文中一共展示了Panel.RenderControl方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendHTMLMail
public static void SendHTMLMail(string mailfrom, string mailto, string mailSubject, Panel panel)
{
try
{
//mailto = "[email protected]";
MailMessage mail = new MailMessage(mailfrom, mailto);
mail.IsBodyHtml = true;
mail.Subject = mailSubject;
mail.BodyEncoding = Encoding.UTF8;
//for test
//String mailcc = "[email protected]";
//mail.CC.Add(mailcc);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
panel.RenderControl(hw);
mail.Body = sw.ToString();
//SmtpClient smtpClient = new SmtpClient("127.0.0.1",25);//設定E-mail Server和port
//SmtpClient smtpClient = new SmtpClient("localhost", 25);//設定E-mail Server和port
//SmtpClient smtpClient = new SmtpClient("192.168.1.20", 25);//設定E-mail Server和port
SmtpClient smtpClient = new SmtpClient(); //從WEB.CONFIG讀SMTP CONFIG
smtpClient.Send(mail);
}
catch (Exception ex)
{
throw ex;
}
}
示例2: getHTML
private string getHTML(Panel Pnl)
{
StringBuilder sb = new StringBuilder();
StringWriter textwriter = new StringWriter(sb);
HtmlTextWriter htmlwriter = new HtmlTextWriter(textwriter);
Pnl.RenderControl(htmlwriter);
htmlwriter.Flush();
textwriter.Flush();
htmlwriter.Dispose();
textwriter.Dispose();
return sb.ToString();
}
示例3: GetDirectFileUploaderHTML
/// <summary>
/// Gets HTML code of rendered DirectFileUploader control.
/// </summary>
/// <param name="mfi">Media file information</param>
public string GetDirectFileUploaderHTML(MediaFileInfo mfi)
{
StringBuilder sb = new StringBuilder();
using (StringWriter tw = new StringWriter(sb))
{
HtmlTextWriter hw = new HtmlTextWriter(tw);
DirectFileUploader dfuElem = Page.LoadControl("~/CMSModules/Content/Controls/Attachments/DirectFileUploader/DirectFileUploader.ascx") as DirectFileUploader;
if (dfuElem != null)
{
using (Panel updatePanel = new Panel())
{
// Initialize update control
innermedia.GetLibraryUpdateControl(ref dfuElem, mfi);
dfuElem.ReloadData();
updatePanel.Attributes["style"] = "height:16px;display:inline;";
updatePanel.Controls.Add(dfuElem);
updatePanel.RenderControl(hw);
}
}
}
return sb.ToString();
}
示例4: RenderRecentlyUsedWebParts
/// <summary>
/// Generates Recently used category to the toolbar.
/// </summary>
/// <param name="allowFiltering">If true the the Recently used category doesn't take a part in filtering</param>
private void RenderRecentlyUsedWebParts(bool allowFiltering)
{
StringBuilder result = new StringBuilder();
List<WebPartInfo> wpList = new List<WebPartInfo>();
// Get recently used web parts from user settings
string[] webParts = currentUser.UserSettings.UserUsedWebParts.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string webPartName in webParts)
{
WebPartInfo wpi = WebPartInfoProvider.GetWebPartInfo(webPartName);
if (wpi != null)
{
wpList.Add(wpi);
}
}
// Sort web parts
wpList = wpList.OrderBy(x => ResHelper.LocalizeString(x.WebPartDisplayName, prefferedUICultureCode)).ToList();
// Create the category
if (webParts.Length > 0)
{
string categoryName = HTMLHelper.HTMLEncode(ResHelper.GetString("webparts.recentlyusedshort", prefferedUICultureCode));
result.Append(@"<div class=""WPTCat""><h4>");
result.Append(categoryName);
if (!allowFiltering)
{
result.Append(@"<!--__NOFILTER__-->");
}
result.Append(@"</h4></div>");
}
foreach (WebPartInfo wp in wpList)
{
// Selector envelope
Panel pnlEnvelope = new Panel();
pnlEnvelope.CssClass = "WPTSelectorEnvelope";
pnlEnvelope.ToolTip = @"<div class=""WPTTH"">" + HTMLHelper.HTMLEncode(ResHelper.LocalizeString(wp.WebPartDisplayName, prefferedUICultureCode)) + @"</div><div class=""WPTTC"">" + HTMLHelper.HTMLEncode(ResHelper.LocalizeString(wp.WebPartDescription, prefferedUICultureCode)) + @"</div>";
// Set the web part id
pnlEnvelope.Attributes.Add("data-webpartid", Convert.ToString(wp.WebPartID));
pnlEnvelope.ID = "wpt_env_" + wp.WebPartID;
// Ensure that when start dragging then a copy of the original web part item will be created
pnlEnvelope.Attributes.Add("data-dragkeepcopy", "1");
pnlEnvelope.Attributes.Add("onmouseover", "wptToggle(this, true);");
pnlEnvelope.Attributes.Add("onmouseout", "wptToggle(this, false);");
// Skip the insert properties dialog when the web part allows this behavior
if (wp.WebPartSkipInsertProperties)
{
pnlEnvelope.Attributes.Add("data-skipdialog", "1");
}
// Handle
Panel pnlHandle = new Panel();
pnlHandle.CssClass = "WPTHandle";
pnlEnvelope.Controls.Add(pnlHandle);
pnlHandle.ID = "wpt_handle_" + wp.WebPartID;
// Thumbnail image
Literal ltlImage = new Literal();
imageHTML = PortalHelper.GetIconHtml(
thumbnailGuid: wp.WebPartThumbnailGUID,
iconClass: wp.WebPartIconClass ?? PortalHelper.DefaultWebPartIconClass);
ltlImage.Text = imageHTML;
pnlHandle.Controls.Add(ltlImage);
// Item text
Literal ltlItemTxt = new Literal();
ltlItemTxt.Text = @"<div>" + HTMLHelper.HTMLEncode(ResHelper.LocalizeString(wp.WebPartDisplayName, prefferedUICultureCode)) + "</div>";
pnlHandle.Controls.Add(ltlItemTxt);
// Get rendered code of web part item
HtmlTextWriter writer = new HtmlTextWriter(new StringWriter(result));
pnlEnvelope.RenderControl(writer);
}
ltlRecentlyUsedWebParts.Text = result.ToString();
}
示例5: RenderControl
/// <summary>
/// Returns the generated HTML markup for a Control object
/// </summary>
private string RenderControl(Panel pnlCard)
{
//Page page = new Page();
////create the runat="server" from that must host asp.net controls
//HtmlForm form = new HtmlForm();
//form.Name = "form1";
//page.Controls.Add(form);
//form.Controls.Add(pnlCard);
////call RenderControl method to get the generated HTML
//string html = RenderControl(pnlCard);
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
HtmlTextWriter writer = new HtmlTextWriter(sw);
pnlCard.RenderControl(writer);
return sb.ToString();
}