本文整理汇总了C#中IHtmlWriter.WriteUnencodedText方法的典型用法代码示例。如果您正苦于以下问题:C# IHtmlWriter.WriteUnencodedText方法的具体用法?C# IHtmlWriter.WriteUnencodedText怎么用?C# IHtmlWriter.WriteUnencodedText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHtmlWriter
的用法示例。
在下文中一共展示了IHtmlWriter.WriteUnencodedText方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
}
示例2: 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();
}
示例3: 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();
}
}
示例4: 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();
}
示例5: 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();
}
示例6: RenderControl
/// <summary>
/// Renders the control into the specified writer.
/// </summary>
protected override void RenderControl(IHtmlWriter writer, IDotvvmRequestContext context)
{
// render resource links
var resources = context.ResourceManager.GetResourcesInOrder().Where(r => r.GetRenderPosition() == ResourceRenderPosition.Body);
foreach (var resource in resources)
{
resource.Render(writer, context);
}
// render the serialized viewmodel
var serializedViewModel = ((DotvvmRequestContext) context).GetSerializedViewModel();
writer.AddAttribute("type", "hidden");
writer.AddAttribute("id", "__dot_viewmodel_root");
writer.AddAttribute("value", serializedViewModel);
writer.RenderSelfClosingTag("input");
// init on load
writer.RenderBeginTag("script");
writer.WriteUnencodedText([email protected]"
window.dotvvm.domUtils.onDocumentReady(function () {{
window.dotvvm.init('root', '{Thread.CurrentThread.CurrentUICulture.Name}');
}});");
writer.RenderEndTag();
}
示例7: 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();
}
}
示例8: RenderContents
protected override void RenderContents(IHtmlWriter writer, RenderContext context)
{
writer.WriteUnencodedText(Text);
}
示例9: RenderControl
/// <summary>
/// Renders the control into the specified writer.
/// </summary>
protected override void RenderControl(IHtmlWriter writer, RenderContext context)
{
var textBinding = GetBinding(TextProperty);
if (textBinding != null && !RenderOnServer)
{
var expression = textBinding.TranslateToClientScript(this, TextProperty);
if (!string.IsNullOrEmpty(FormatString))
{
expression = "redwood.formatString(" + JsonConvert.SerializeObject(FormatString) + ", " + expression + ")";
}
writer.AddKnockoutDataBind(HtmlEncode ? "text" : "html", expression);
writer.RenderBeginTag("span");
writer.RenderEndTag();
}
else
{
var textToDisplay = Text;
if (!string.IsNullOrEmpty(FormatString))
{
textToDisplay = string.Format("{0:" + FormatString + "}", textToDisplay);
}
if (HtmlEncode)
{
writer.WriteText(textToDisplay);
}
else
{
writer.WriteUnencodedText(textToDisplay);
}
}
}
示例10: RenderContents
protected override void RenderContents(IHtmlWriter writer, IDotvvmRequestContext context)
{
if (RenderOnServer || !HasBinding(HtmlProperty))
{
writer.WriteUnencodedText(Html);
}
}
示例11: Render
public override void Render(IHtmlWriter writer, IDotvvmRequestContext context)
{
writer.WriteUnencodedText(EncodedText);
}
示例12: RenderControl
/// <summary>
/// Renders the control into the specified writer.
/// </summary>
protected override void RenderControl(IHtmlWriter writer, RenderContext context)
{
var textBinding = GetBinding(TextProperty);
if (textBinding != null && !RenderOnServer && textBinding.Javascript != null)
{
var expression = textBinding.Javascript;
if (!string.IsNullOrEmpty(FormatString))
{
expression = "dotvvm.formatString(" + JsonConvert.SerializeObject(FormatString) + ", " + expression + ")";
}
writer.AddKnockoutDataBind(HtmlEncode ? "text" : "html", expression);
AddAttributesToRender(writer, context);
writer.RenderBeginTag("span");
writer.RenderEndTag();
}
else
{
if (AlwaysRenderSpan)
{
AddAttributesToRender(writer, context);
writer.RenderBeginTag("span");
}
var textToDisplay = "";
if (!string.IsNullOrEmpty(FormatString))
{
textToDisplay = string.Format("{0:" + FormatString + "}", GetValue(TextProperty));
}
else
{
textToDisplay = GetValue(TextProperty)?.ToString() ?? "";
}
if (HtmlEncode)
{
writer.WriteText(textToDisplay);
}
else
{
writer.WriteUnencodedText(textToDisplay);
}
if (AlwaysRenderSpan)
{
writer.RenderEndTag();
}
}
}
示例13: RenderUploadButton
private void RenderUploadButton(IHtmlWriter writer)
{
// render upload button
writer.AddAttribute("class", "dotvvm-upload-button");
writer.AddKnockoutDataBind("visible", "!IsBusy()");
writer.RenderBeginTag("span");
writer.AddAttribute("href", "#");
writer.AddAttribute("onclick", "dotvvm.fileUpload.showUploadDialog(this); return false;");
writer.RenderBeginTag("a");
writer.WriteUnencodedText(UploadButtonText);
writer.RenderEndTag();
writer.RenderEndTag();
}
示例14: RenderContents
protected override void RenderContents(IHtmlWriter writer, RenderContext context)
{
// render iframe
writer.AddAttribute("class", "rw-upload-iframe");
writer.AddAttribute("src", "~/" + Constants.FileUploadHandlerMatchUrl + (AllowMultipleFiles ? "?multiple=true" : ""));
writer.AddAttribute("id", ID + "_iframe");
writer.AddAttribute("data-target-control-id", ID);
writer.RenderBeginTag("iframe");
writer.RenderEndTag();
// render upload button
writer.AddAttribute("class", "rw-upload-button");
writer.AddKnockoutDataBind("visible", "!IsBusy()");
writer.RenderBeginTag("span");
writer.AddAttribute("href", "#");
writer.AddAttribute("onclick", string.Format("redwood.fileUpload.showUploadDialog('{0}_iframe'); return false;", ID));
writer.RenderBeginTag("a");
writer.WriteUnencodedText("Upload"); // TODO: localization
writer.RenderEndTag();
writer.RenderEndTag();
// render upload files
writer.AddAttribute("class", "rw-upload-files");
writer.AddKnockoutDataBind("html", "redwood.format('{0} files', Files().length)"); // TODO: localization
writer.RenderBeginTag("span");
writer.RenderEndTag();
// render progress wrapper
writer.AddKnockoutDataBind("visible", "IsBusy");
writer.AddAttribute("class", "rw-upload-progress-wrapper");
writer.RenderBeginTag("span");
writer.AddAttribute("class", "rw-upload-progress");
writer.AddKnockoutDataBind("style", "{ 'width': (Progress() == -1 ? '50' : Progress()) + '%' }");
writer.RenderBeginTag("span");
writer.RenderEndTag();
writer.RenderEndTag();
// render result
writer.AddAttribute("class", "rw-upload-result");
writer.AddKnockoutDataBind("html", "Error() ? 'Error occured.' : 'The files are uploaded.'"); // TODO: localization
writer.AddKnockoutDataBind("attr", "{ title: Error }");
writer.AddKnockoutDataBind("css", "{ 'rw-upload-result-success': !Error(), 'rw-upload-result-error': Error }");
writer.AddKnockoutDataBind("visible", "!IsBusy() && Files().length > 0");
writer.RenderBeginTag("span");
writer.RenderEndTag();
base.RenderContents(writer, context);
}