本文整理汇总了C#中System.Web.UI.HtmlTextWriter.RenderEndTag方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlTextWriter.RenderEndTag方法的具体用法?C# HtmlTextWriter.RenderEndTag怎么用?C# HtmlTextWriter.RenderEndTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.HtmlTextWriter
的用法示例。
在下文中一共展示了HtmlTextWriter.RenderEndTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RadioButton
/// <summary>
/// Renders the RadioButton
/// </summary>
/// <param name="helper">The helper.</param>
/// <param name="displayText">The display text.</param>
/// <param name="radioButtonName">Name of the radio button.</param>
/// <param name="radioButtonValue">The radio button value.</param>
/// <param name="radioButtonId">The radio button id.</param>
/// <param name="radioButtonIsChecked">if set to <c>true</c> [radio button is checked].</param>
/// <param name="radioButtonHtmlAttributes">The radio button HTML attributes.</param>
/// <returns></returns>
public static string RadioButton(this HtmlHelper helper, string displayText, string radioButtonName, object radioButtonValue, string radioButtonId, bool radioButtonIsChecked, IDictionary<string, object> radioButtonHtmlAttributes)
{
var writer = new HtmlTextWriter(new StringWriter());
writer.AddAttribute("for", radioButtonId);
writer.RenderBeginTag(HtmlTextWriterTag.Label);
writer.AddAttribute("type", "radio");
writer.AddAttribute("id", radioButtonId);
writer.AddAttribute("name", radioButtonName);
writer.AddAttribute("value", radioButtonValue.ToString());
if (radioButtonIsChecked)
{
writer.AddAttribute("checked", "checked");
}
foreach (var pair in radioButtonHtmlAttributes)
{
writer.AddAttribute(pair.Key, pair.Value.ToString());
}
writer.RenderBeginTag(HtmlTextWriterTag.Input);
writer.RenderEndTag();
writer.WriteEncodedText(displayText);
writer.RenderEndTag();
return writer.InnerWriter.ToString();
}
示例2: RenderControl
/// <summary>
/// Outputs server control content to a provided <see cref="T:System.Web.UI.HtmlTextWriter" /> object and stores tracing information about the control if tracing is enabled.
/// </summary>
/// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> object that receives the control content.</param>
public override void RenderControl( HtmlTextWriter writer )
{
if ( this.Visible )
{
string alertType = NotificationBoxType.ToString().ToLower();
bool showMessage = !string.IsNullOrWhiteSpace( Heading ) || !string.IsNullOrWhiteSpace( Title ) || !string.IsNullOrWhiteSpace( this.Text );
if ( showMessage )
{
writer.AddAttribute( "class", "alert alert-" + alertType );
writer.RenderBeginTag( HtmlTextWriterTag.Div );
if ( !string.IsNullOrWhiteSpace( Heading ) )
{
writer.RenderBeginTag( HtmlTextWriterTag.H4 );
writer.Write( Heading );
writer.RenderEndTag();
}
if ( !string.IsNullOrWhiteSpace( Title ) )
{
writer.RenderBeginTag( HtmlTextWriterTag.Strong );
writer.Write( Title + " ");
writer.RenderEndTag();
}
base.RenderControl( writer );
writer.RenderEndTag();
}
}
}
示例3: WriteSkipLinkStart
internal static void WriteSkipLinkStart(HtmlTextWriter writer, Version renderingCompatibility, bool designMode, string skipLinkText, string spacerImageUrl, string clientID) {
if (skipLinkText.Length != 0 && !designMode) {
if (renderingCompatibility >= VersionUtil.Framework45) {
writer.AddAttribute(HtmlTextWriterAttribute.Href, '#' + clientID + SkipLinkContentMark);
writer.AddStyleAttribute(HtmlTextWriterStyle.Position, "absolute");
writer.AddStyleAttribute(HtmlTextWriterStyle.Left, "-10000px");
writer.AddStyleAttribute(HtmlTextWriterStyle.Top, "auto");
writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "1px");
writer.AddStyleAttribute(HtmlTextWriterStyle.Height, "1px");
writer.AddStyleAttribute(HtmlTextWriterStyle.Overflow, "hidden");
writer.RenderBeginTag(HtmlTextWriterTag.A);
writer.Write(skipLinkText);
writer.RenderEndTag();
}
else {
writer.AddAttribute(HtmlTextWriterAttribute.Href, '#' + clientID + SkipLinkContentMark);
writer.RenderBeginTag(HtmlTextWriterTag.A);
writer.AddAttribute(HtmlTextWriterAttribute.Alt, skipLinkText);
writer.AddAttribute(HtmlTextWriterAttribute.Src, spacerImageUrl);
writer.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, "0px");
writer.AddAttribute(HtmlTextWriterAttribute.Width, "0");
writer.AddAttribute(HtmlTextWriterAttribute.Height, "0");
writer.RenderBeginTag(HtmlTextWriterTag.Img);
writer.RenderEndTag();
writer.RenderEndTag();
}
}
}
示例4: Render
protected override void Render(HtmlTextWriter writer)
{
//// Определение атрибута, содержащего ссылку
//writer.AddAttribute(HtmlTextWriterAttribute.Href, "http://example.com");
//// Определение стиля атрибута (размер шрифат)
//writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, "30");
//// Открытие тега <a>
//writer.RenderBeginTag(HtmlTextWriterTag.A);
//// Вывод статического содержимого на страницу
//writer.Write("Web Forms");
//// Закрытие тега <a>
//writer.RenderEndTag();
Param1 = "Груша";
Param2 = "Яблоко";
Param3 = "Слива";
writer.RenderBeginTag(HtmlTextWriterTag.Ol);
writer.RenderBeginTag(HtmlTextWriterTag.Li);
writer.Write(Param1);
writer.RenderEndTag();
writer.RenderBeginTag(HtmlTextWriterTag.Li);
writer.Write(Param2);
writer.RenderEndTag();
writer.RenderBeginTag(HtmlTextWriterTag.Li);
writer.Write(Param3);
writer.RenderEndTag();
writer.RenderEndTag();
}
示例5: Build
/// <summary>
/// 获取表单字段的html
/// </summary>
public string Build(FormField field, Dictionary<string, string> htmlAttributes) {
var provider = Application.Ioc.Resolve<FormHtmlProvider>();
var attribute = (CaptchaFieldAttribute)field.Attribute;
var html = new HtmlTextWriter(new StringWriter());
// 控件组
html.AddAttribute("class", "input-group");
html.RenderBeginTag("div");
// 输入框
foreach (var pair in provider.FormControlAttributes) {
html.AddAttribute(pair.Key, pair.Value);
}
html.AddAttribute("name", field.Attribute.Name);
html.AddAttribute("value", (field.Value ?? "").ToString());
html.AddAttribute("type", "text");
html.AddAttribute("placeholder", new T(attribute.PlaceHolder));
foreach (var pair in htmlAttributes) {
html.AddAttribute(pair.Key, pair.Value);
}
html.RenderBeginTag("input");
html.RenderEndTag();
// 验证码图片
html.AddAttribute("class", "input-group-addon");
html.RenderBeginTag("span");
html.AddAttribute("alt", new T("Captcha"));
html.AddAttribute("class", "captcha");
html.AddAttribute("src", "/captcha?key=" + attribute.Key);
html.AddAttribute("title", new T("Click to change captcha image"));
html.RenderBeginTag("img");
html.RenderEndTag(); // img
html.RenderEndTag(); // span
html.RenderEndTag(); // div
return provider.FormGroupHtml(
field, htmlAttributes, html.InnerWriter.ToString());
}
示例6: TestOutputSection
public TestOutputSection(string testOutput, string backHref, string height = "90%")
{
var stringWriter = new StringWriter();
using (var writer = new HtmlTextWriter(stringWriter))
{
writer.AddStyleAttribute(HtmlTextWriterStyle.Height, height);
writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, Colors.White);
writer.AddStyleAttribute(HtmlTextWriterStyle.Overflow, "scroll");
writer.RenderBeginTag(HtmlTextWriterTag.Div);
writer.AddStyleAttribute(HtmlTextWriterStyle.Margin, "1% 2% 3% 97%");
writer.RenderBeginTag(HtmlTextWriterTag.Div);
writer.Write(new CloseButton("Back", backHref).ButtonHtml);
writer.RenderEndTag(); //DIV
writer.AddStyleAttribute(HtmlTextWriterStyle.Margin, "5%");
writer.RenderBeginTag(HtmlTextWriterTag.Div);
writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "pre-line");
writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, Colors.White);
writer.RenderBeginTag(HtmlTextWriterTag.Div);
writer.Write(testOutput);
writer.RenderEndTag();//DIV
writer.RenderEndTag(); //DIV
writer.RenderEndTag(); //DIV
}
HtmlCode = stringWriter.ToString();
}
示例7: RenderContents
protected override void RenderContents(HtmlTextWriter output)
{
output.RenderBeginTag(HtmlTextWriterTag.Div);
output.RenderBeginTag(HtmlTextWriterTag.Input);
output.RenderEndTag();
output.RenderEndTag();
}
示例8: Render
//-------------------------------------------------------------------------------------------
protected override void Render(HtmlTextWriter writer)
{
if (!Visible)
{
return;
}
writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, BorderStyle.ToString());
writer.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, BorderWidth.ToString());
writer.AddAttribute(HtmlTextWriterAttribute.Width, Width.ToString());
writer.AddAttribute(HtmlTextWriterAttribute.Href, Height.ToString());
writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
writer.RenderBeginTag("table");
writer.AddAttribute(HtmlTextWriterAttribute.Class, "groupboxtitle");
writer.RenderBeginTag("tr");
writer.AddAttribute(HtmlTextWriterAttribute.Background, "images/group-box-bar.gif");
writer.RenderBeginTag("td");
writer.Write(Text);
writer.RenderEndTag();
writer.RenderEndTag();
for (int i = 0; i < Items.Count; i++)
{
RenderItemRow(writer, Items[i]);
}
writer.RenderEndTag();
}
示例9: Render
//***************************************************************************
// Private Methods
//
protected override void Render(HtmlTextWriter writer)
{
base.Render(writer);
if (!this.CheckRender())
return;
writer.AddAttribute(HtmlTextWriterAttribute.Class, string.IsNullOrEmpty(this.CssClass)
? "iconGroup"
: this.CssClass);
writer.RenderBeginTag(HtmlTextWriterTag.Fieldset);
writer.RenderBeginTag(HtmlTextWriterTag.Legend);
writer.WriteEncodedText(this._menuItem.Text);
writer.RenderEndTag(); // Legend
foreach (Control c in this.Controls)
{
if (!(c is DynamicMenuChildControl))
continue;
c.RenderControl(writer);
}
writer.RenderEndTag(); // Fieldset
}
示例10: Render
protected override void Render(HtmlTextWriter writer)
{
base.Render(writer);
Writer = writer;
WriteTitle("FedAuth Cookie Information");
if (false == present)
{
writer.Write("Cookie not present");
return;
}
writer.RenderBeginTag(HtmlTextWriterTag.Dl);
foreach (String key in rawValues.AllKeys)
RenderListEntry(key, rawValues[key]);
writer.RenderEndTag();
writer.RenderBeginTag(HtmlTextWriterTag.Dl);
RenderListEntry("Context", context);
RenderListEntry("IsPersistent", isPersistent);
RenderListEntry("IsSessionMode", isSessionMode);
RenderListEntry("Id", id);
RenderListEntry("ValidFrom", validFrom);
RenderListEntry("ValidTo", validTo);
writer.RenderEndTag();
}
示例11: RenderScores
private static void RenderScores(HtmlTextWriter htmlWriter, MatchHeaderInfo match, int player)
{
htmlWriter.AddAttribute(HtmlTextWriterAttribute.Class, "scores");
htmlWriter.RenderBeginTag(HtmlTextWriterTag.Div);
if (match.SetScores.IsNullOrEmpty() && (int)match.Status < (int)MatchStatus.Completed)
{
if (player == 0)
{
htmlWriter.Write(match.Date);
}
else if (match.StartTime.HasValue)
{
htmlWriter.Write(match.StartTime.Value.ToString("HH:mm"));
}
}
else
{
foreach (var setScore in match.SetScores)
{
htmlWriter.RenderBeginTag(HtmlTextWriterTag.Span);
var points = (player == 0 ? setScore.Player1Points : setScore.Player2Points);
htmlWriter.Write(points == 0 ? " " : points.ToString());
htmlWriter.RenderEndTag();
}
}
htmlWriter.RenderEndTag();
}
示例12: Render
protected override void Render(HtmlTextWriter writer)
{
writer.AddAttribute(HtmlTextWriterAttribute.Id, string.Concat(ClientID, "-container"));
writer.AddAttribute(HtmlTextWriterAttribute.Class, "button");
writer.RenderBeginTag(HtmlTextWriterTag.Span);
if ( NavigateUrl == null )
{
AddAttributesToRender(writer);
}
else
{
string path = NavigateUrl;
string qs = string.Empty;
int splitIndex = path.IndexOf('?');
if ( splitIndex != -1 )
{
path = NavigateUrl.Substring(0, splitIndex);
qs = NavigateUrl.Substring(splitIndex);
}
path = VirtualPathUtility.ToAbsolute(path);
writer.AddAttribute(HtmlTextWriterAttribute.Href, string.Concat(path, qs));
}
writer.RenderBeginTag(HtmlTextWriterTag.A);
writer.WriteEncodedText(Text);
writer.RenderEndTag();
writer.RenderEndTag();
}
示例13: Render
protected override void Render(HtmlTextWriter writer)
{
writer.AddAttribute(HtmlTextWriterAttribute.Class, "qsfSkinMgr");
writer.RenderBeginTag(HtmlTextWriterTag.Div);
writer.AddAttribute(HtmlTextWriterAttribute.Class, "qscLink");
writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "javascript:openSkinChooser(event);");
writer.RenderBeginTag(HtmlTextWriterTag.A);
RenderTitle(writer);
writer.RenderEndTag(); // qscLink
writer.AddAttribute(HtmlTextWriterAttribute.Class, "qscAnimContainer");
writer.RenderBeginTag(HtmlTextWriterTag.Div);
writer.AddAttribute(HtmlTextWriterAttribute.Class, "qscDropDown");
writer.RenderBeginTag(HtmlTextWriterTag.Div);
RenderCorners(writer);
RenderChooser(writer, GetSkinChooser());
writer.RenderEndTag(); // qscDropDown
writer.RenderEndTag(); // qscAnimationContainer
writer.RenderEndTag(); // qsfSkinMgt
}
示例14: RenderWebPart
public override void RenderWebPart(HtmlTextWriter writer, WebPart webPart)
{
if (webPart == null)
{
throw new ArgumentNullException("webPart");
}
base.Zone.PartChromeStyle.AddAttributesToRender(writer, base.Zone);
writer.AddAttribute(HtmlTextWriterAttribute.Class, "divzone_part_chrome");
writer.RenderBeginTag(HtmlTextWriterTag.Div);
if (base.WebPartManager.DisplayMode == WebPartManager.EditDisplayMode || webPart.ChromeType != PartChromeType.None || !webPart.Hidden)
{
this.RenderTitleBar(writer, webPart);
}
base.Zone.PartStyle.AddAttributesToRender(writer, base.Zone);
if (webPart.Hidden && !base.WebPartManager.DisplayMode.ShowHiddenWebParts)
{
writer.AddAttribute(HtmlTextWriterAttribute.Class, "divzone_part_hidden");
}
else
{
writer.AddAttribute(HtmlTextWriterAttribute.Class, "divzone_part");
}
writer.RenderBeginTag(HtmlTextWriterTag.Div);
this.RenderPartContents(writer, webPart);
writer.RenderEndTag();
writer.RenderEndTag();
}
示例15: WriteButton
private static void WriteButton(HtmlTextWriter writer, ToolBarButton button)
{
writer.AddAttribute(HtmlTextWriterAttribute.Class, "g_ToolbarButton");
if(!string.IsNullOrEmpty(button.Id))
{
writer.AddAttribute(HtmlTextWriterAttribute.Id, button.Id);
}
writer.RenderBeginTag(HtmlTextWriterTag.Span);
writer.AddAttribute(HtmlTextWriterAttribute.Href, button.Url);
if(!string.IsNullOrEmpty(button.Onclick))
{
writer.AddAttribute(HtmlTextWriterAttribute.Onclick, button.Onclick);
}
writer.RenderBeginTag(HtmlTextWriterTag.A);
if(!string.IsNullOrEmpty(button.Img))
{
writer.AddAttribute(HtmlTextWriterAttribute.Src, button.Img);
writer.AddAttribute(HtmlTextWriterAttribute.Alt, button.Alt);
writer.RenderBeginTag(HtmlTextWriterTag.Img);
writer.RenderEndTag();
}
writer.Write(button.Title);
writer.RenderEndTag();
writer.RenderEndTag();
}