本文整理汇总了C#中IHtmlWriter.RenderEndTag方法的典型用法代码示例。如果您正苦于以下问题:C# IHtmlWriter.RenderEndTag方法的具体用法?C# IHtmlWriter.RenderEndTag怎么用?C# IHtmlWriter.RenderEndTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHtmlWriter
的用法示例。
在下文中一共展示了IHtmlWriter.RenderEndTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
/// <summary>
/// Renders the resource in the specified <see cref="IHtmlWriter" />.
/// </summary>
public override void Render(IHtmlWriter writer, IDotvvmRequestContext context)
{
if (CdnUrl != null)
{
writer.AddAttribute("src", CdnUrl);
writer.AddAttribute("type", "text/javascript");
writer.RenderBeginTag("script");
writer.RenderEndTag();
if (Url != null && GlobalObjectName != null)
{
writer.RenderBeginTag("script");
var url = context.TranslateVirtualPath(GetUrl());
writer.WriteUnencodedText(string.Format(CdnFallbackScript, GlobalObjectName, url));
writer.RenderEndTag();
}
}
else if (Url != null)
{
writer.AddAttribute("src", GetUrl());
writer.AddAttribute("type", "text/javascript");
writer.RenderBeginTag("script");
writer.RenderEndTag();
}
}
示例2: RenderControl
/// <summary>
/// Renders the specified writer.
/// </summary>
protected override void RenderControl(IHtmlWriter writer)
{
writer.RenderBeginTag("table");
if (ItemTemplate != null)
{
var itemsSourceExpression = KnockoutBindingHelper.GetBindingExpressionOrNull(ItemsSourceProperty, this);
if (KnockoutBindingHelper.IsKnockoutBinding(itemsSourceExpression))
{
// knockout template
writer.RenderBeginTag("tbody");
writer.AddBindingAttribute("foreach", KnockoutBindingHelper.TranslateToKnockoutProperty(this, ItemsSourceProperty, itemsSourceExpression));
if (string.IsNullOrEmpty(KeyPropertyName))
{
ItemTemplate.DataContext = CreateClientTemplateInstanceDataContextBinding();
}
else
{
ItemTemplate.DataContext = CreateClientTemplateInstanceDataContextBinding(KeyPropertyName);
}
ItemTemplate.Render(writer);
writer.RenderEndTag();
}
else if (ItemsSource != null)
{
writer.RenderBeginTag("tbody");
var index = 0;
var rawItemsSourceValue = this.GetRawValue(ItemsSourceProperty);
foreach (var item in ItemsSource)
{
// render on server side
writer.RenderBeginTag("tr");
if (string.IsNullOrEmpty(KeyPropertyName) || item == null)
{
ItemTemplate.DataContext = CreateServerTemplateInstanceDataContextBinding(index);
}
else
{
var keyValue = GetKeyValue(item);
ItemTemplate.DataContext = CreateServerTemplateInstanceDataContextBinding(KeyPropertyName, keyValue);
}
ItemTemplate.Render(writer);
writer.RenderEndTag();
index++;
}
writer.RenderEndTag();
}
}
writer.RenderEndTag();
}
示例3: RenderControl
protected override void RenderControl(IHtmlWriter writer)
{
// begin
if (Mode == TextMode.MultiLine)
{
writer.RenderBeginTag("textarea");
}
else
{
writer.RenderBeginTag("input");
writer.AddAttribute("type", Mode.ToString().ToLower());
}
// content
var expr = KnockoutBindingHelper.GetBindingExpressionOrNull(TextProperty, this);
if (!KnockoutBindingHelper.IsKnockoutBinding(expr))
{
if (Mode == TextMode.MultiLine)
{
writer.WriteText(Text, true);
}
else
{
writer.AddAttribute("value", Text);
}
}
else
{
writer.AddBindingAttribute("value", KnockoutBindingHelper.TranslateToKnockoutProperty(this, TextProperty, expr));
}
// end
writer.RenderEndTag();
}
示例4: RenderContents
/// <summary>
/// Renders the contents inside the control begin and end tags.
/// </summary>
protected override void RenderContents(IHtmlWriter writer, IDotvvmRequestContext context)
{
// render template
writer.AddKnockoutDataBind("text", "errorMessage");
writer.RenderBeginTag("li");
writer.RenderEndTag();
}
示例5: RenderContents
/// <summary>
/// Renders the contents inside the control begin and end tags.
/// </summary>
protected override void RenderContents(IHtmlWriter writer, RenderContext context)
{
if (RenderOnServer)
{
// render items
bool first = true;
foreach (var item in GetIEnumerableFromDataSource(DataSource))
{
var value = string.IsNullOrEmpty(ValueMember) ? item : ReflectionUtils.GetObjectProperty(item, ValueMember);
var text = string.IsNullOrEmpty(DisplayMember) ? item : ReflectionUtils.GetObjectProperty(item, DisplayMember);
if (first)
{
writer.WriteUnencodedText(Environment.NewLine);
first = false;
}
writer.WriteUnencodedText(" "); //Indent
writer.AddAttribute("value", value != null ? value.ToString() : "");
writer.RenderBeginTag("option");
writer.WriteText(text != null ? text.ToString() : "");
writer.RenderEndTag();
writer.WriteUnencodedText(Environment.NewLine);
}
}
}
示例6: Render
/// <summary>
/// Renders the resource in the specified <see cref="IHtmlWriter" />.
/// </summary>
public override void Render(IHtmlWriter writer, string friendlyName = null)
{
writer.AddAttribute("type", "text/javascript");
writer.RenderBeginTag("script");
writer.WriteUnencodedText(Code);
writer.RenderEndTag();
}
示例7: RenderControl
protected override void RenderControl(IHtmlWriter writer)
{
writer.RenderBeginTag(Element);
if (htmlAttributesStorage != null)
htmlAttributesStorage.Render(writer);
base.RenderControl(writer);
writer.RenderEndTag(true);
}
示例8: RenderLabel
private void RenderLabel(IHtmlWriter writer)
{
writer.AddAttribute("class", "control-label col-sm-2");
var textBinding = GetBinding(LabelTextProperty);
if (textBinding != null)
{
writer.AddKnockoutDataBind("text", this, LabelTextProperty, () => { });
writer.RenderBeginTag("label");
writer.RenderEndTag();
}
else
{
writer.RenderBeginTag("label");
writer.WriteText(LabelText);
writer.RenderEndTag();
}
}
示例9: Render
/// <summary>
/// Renders the resource in the specified <see cref="IHtmlWriter" />.
/// </summary>
public override void Render(IHtmlWriter writer, IDotvvmRequestContext context)
{
if (string.IsNullOrWhiteSpace(Code)) return;
writer.AddAttribute("type", "text/javascript");
writer.RenderBeginTag("script");
writer.WriteUnencodedText(Code);
writer.RenderEndTag();
}
示例10: RenderContents
protected override void RenderContents(IHtmlWriter writer, RenderContext context)
{
RenderLabel(writer);
writer.AddAttribute("class", "col-sm-10");
writer.RenderBeginTag("div");
RenderChildren(writer, context);
writer.RenderEndTag();
}
示例11: RenderControl
protected override void RenderControl(IHtmlWriter writer)
{
if (InternalScriptUrls != null)
{
foreach (var script in InternalScriptUrls)
{
writer.RenderBeginTag("script");
writer.AddAttribute("type", "text/javascript");
writer.AddAttribute("src", script);
writer.RenderEndTag(true);
}
}
writer.RenderBeginTag("script");
writer.AddAttribute("type", "text/javascript");
writer.WriteText("(function () { var viewModelData = ", false);
writer.WriteText(SerializedViewModel, false);
writer.WriteText(";var vm = Redwood.CreateViewModel(viewModelData, new " + ViewModelClientName + "());ko.applyBindings(vm);Redwood.ViewModels['Default'] = vm;})();", false);
writer.RenderEndTag();
}
示例12: RenderControl
protected override void RenderControl(IHtmlWriter writer)
{
var textExpression = KnockoutBindingHelper.GetBindingExpressionOrNull(TextProperty, this);
var needsLabel = KnockoutBindingHelper.IsKnockoutBinding(textExpression) || !string.IsNullOrEmpty(Text);
// render the checkbox
writer.RenderBeginTag("input");
writer.AddAttribute("type", "checkbox");
var isCheckedExpression = KnockoutBindingHelper.GetBindingExpressionOrNull(IsCheckedProperty, this);
if (KnockoutBindingHelper.IsKnockoutBinding(isCheckedExpression))
{
writer.AddBindingAttribute("checked", KnockoutBindingHelper.TranslateToKnockoutProperty(this, IsCheckedProperty, isCheckedExpression));
}
else
{
writer.AddAttribute("checked", IsChecked ? "checked" : "");
}
if (needsLabel)
{
EnsureHasID();
writer.AddAttribute("id", ID);
}
writer.RenderEndTag();
// render the label
if (needsLabel)
{
writer.RenderBeginTag("label");
writer.AddAttribute("for", ID);
if (KnockoutBindingHelper.IsKnockoutBinding(textExpression))
{
writer.AddBindingAttribute("", KnockoutBindingHelper.TranslateToKnockoutProperty(this, TextProperty, textExpression));
}
else
{
writer.WriteText(Text, true);
}
writer.RenderEndTag();
}
}
示例13: RenderContents
protected override void RenderContents(IHtmlWriter writer, RenderContext context)
{
if (RenderOnServer)
{
if (!string.IsNullOrWhiteSpace(EmptyItemText))
{
writer.RenderBeginTag("option");
writer.WriteText(EmptyItemText);
writer.RenderEndTag();
}
}
base.RenderContents(writer, context);
}
示例14: Render
/// <summary>
/// Renders the resource in the specified <see cref="IHtmlWriter" />.
/// </summary>
public override void Render(IHtmlWriter writer, string friendlyName = null)
{
if (CdnUrl != null)
{
writer.AddAttribute("src", CdnUrl);
writer.AddAttribute("type", "text/javascript");
writer.RenderBeginTag("script");
writer.RenderEndTag();
if (Url != null && GlobalObjectName != null)
{
writer.RenderBeginTag("script");
writer.WriteUnencodedText(string.Format(CdnFallbackScript, GlobalObjectName, GetUrl(friendlyName)));
writer.RenderEndTag();
}
}
else if (Url != null)
{
writer.AddAttribute("src", GetUrl(friendlyName));
writer.AddAttribute("type", "text/javascript");
writer.RenderBeginTag("script");
writer.RenderEndTag();
}
}
示例15: RenderControl
/// <summary>
/// Renders the control into the specified writer.
/// </summary>
protected override void RenderControl(IHtmlWriter writer, RenderContext context)
{
// render resource links
var resources = context.ResourceManager.GetResourcesInOrder().Where(r => r.GetRenderPosition() == ResourceRenderPosition.Body);
foreach (var resource in resources)
{
resource.Render(writer);
}
// render the serialized viewmodel
var serializedViewModel = context.RequestContext.GetSerializedViewModel();
writer.AddAttribute("type", "hidden");
writer.AddAttribute("id", "__rw_viewmodel_" + context.CurrentPageArea);
writer.AddAttribute("value", serializedViewModel);
writer.RenderSelfClosingTag("input");
// init on load
writer.RenderBeginTag("script");
writer.WriteUnencodedText(string.Format("redwood.onDocumentReady(function () {{ redwood.init('{0}', '{1}'); }});", context.CurrentPageArea, Thread.CurrentThread.CurrentUICulture.Name));
writer.RenderEndTag();
}