当前位置: 首页>>代码示例>>C#>>正文


C# IHtmlWriter.RenderSelfClosingTag方法代码示例

本文整理汇总了C#中IHtmlWriter.RenderSelfClosingTag方法的典型用法代码示例。如果您正苦于以下问题:C# IHtmlWriter.RenderSelfClosingTag方法的具体用法?C# IHtmlWriter.RenderSelfClosingTag怎么用?C# IHtmlWriter.RenderSelfClosingTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IHtmlWriter的用法示例。


在下文中一共展示了IHtmlWriter.RenderSelfClosingTag方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Render

 /// <summary>
 /// Renders the resource in the specified <see cref="IHtmlWriter" />.
 /// </summary>
 public override void Render(IHtmlWriter writer, IDotvvmRequestContext context)
 {
     writer.AddAttribute("href", GetUrl());
     writer.AddAttribute("rel", "stylesheet");
     writer.AddAttribute("type", "text/css");
     writer.RenderSelfClosingTag("link");
 }
开发者ID:darilek,项目名称:dotvvm,代码行数:10,代码来源:StylesheetResource.cs

示例2: RenderInputTag

        /// <summary>
        /// Renders the input tag.
        /// </summary>
        protected override void RenderInputTag(IHtmlWriter writer)
        {
            var checkedBinding = GetValueBinding(CheckedProperty);
            var checkedItemsBinding = GetValueBinding(CheckedItemsProperty);

            if (checkedBinding != null && checkedItemsBinding == null)
            {
                // boolean mode
                writer.AddKnockoutDataBind("checked", this, CheckedProperty, () => { });
                writer.AddKnockoutDataBind("checkedValue", "true");
            }
            else if (checkedBinding == null && checkedItemsBinding != null)
            {
                // collection mode
                writer.AddKnockoutDataBind("checked", this, CheckedItemsProperty, () => { });
                writer.AddKnockoutDataBind("checkedValue", this, CheckedValueProperty, () =>
                {
                    var checkedValue = (CheckedValue ?? string.Empty).ToString();
                    if (!string.IsNullOrEmpty(checkedValue))
                    {
                        writer.AddKnockoutDataBind("checkedValue", KnockoutHelper.MakeStringLiteral(checkedValue));
                    }
                });
            }
            else
            {
                throw new Exception("Either the Checked or the CheckedItems property of a CheckBox must be set.");
            }

            // render the input tag
            writer.AddAttribute("type", "checkbox");
            writer.RenderSelfClosingTag("input");
        }
开发者ID:holajan,项目名称:dotvvm,代码行数:36,代码来源:CheckBox.cs

示例3: Render

 /// <summary>
 /// Renders the resource in the specified <see cref="IHtmlWriter" />.
 /// </summary>
 public override void Render(IHtmlWriter writer, string friendlyName = null)
 {
     writer.AddAttribute("href", GetUrl(friendlyName));
     writer.AddAttribute("rel", "stylesheet");
     writer.AddAttribute("type", "text/css");
     writer.RenderSelfClosingTag("link");
 }
开发者ID:holajan,项目名称:dotvvm,代码行数:10,代码来源:StylesheetResource.cs

示例4: RenderInputTag

        protected override void RenderInputTag(IHtmlWriter writer)
        {
            RenderCheckedAttribute(writer);
            RenderCheckedValueAttribute(writer);
            RenderTypeAttribute(writer);
            RenderGroupNameAttribute(writer);

            writer.RenderSelfClosingTag("input");
        }
开发者ID:darilek,项目名称:dotvvm,代码行数:9,代码来源:RadioButton.cs

示例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();
        }
开发者ID:adamjez,项目名称:dotvvm,代码行数:24,代码来源:BodyResourceLinks.cs

示例6: RenderInputTag

        /// <summary>
        /// Renders the input tag.
        /// </summary>
        protected override void RenderInputTag(IHtmlWriter writer)
        {
            if (HasBinding(CheckedProperty) && !HasBinding(CheckedItemsProperty))
            {
                // boolean mode
                RenderCheckedProperty(writer);
            }
            else if (!HasBinding(CheckedProperty) && HasBinding(CheckedItemsProperty))
            {
                if (GetValue(CheckedItemsProperty) == null)
                {
                    throw new DotvvmControlException(this, "CheckedItems property cannot contain null!");
                }
                // collection mode
                RenderCheckedItemsProperty(writer);
            }
            else
            {
                throw new DotvvmControlException(this, "Either the Checked or the CheckedItems binding of a CheckBox must be set.");
            }

            RenderTypeAttribute(writer);
            writer.RenderSelfClosingTag("input");
        }
开发者ID:darilek,项目名称:dotvvm,代码行数:27,代码来源:CheckBox.cs

示例7: RenderInputTag

        protected override void RenderInputTag(IHtmlWriter writer)
        {
            var checkedItemBinding = GetBinding(CheckedItemProperty);
            if (checkedItemBinding != null)
            {
                // selected item mode
                writer.AddKnockoutDataBind("checked", this, CheckedItemProperty, () => { });
                writer.AddKnockoutDataBind("checkedValue", this, CheckedValueProperty, () =>
                {
                    var checkedValue = (CheckedValue ?? string.Empty).ToString();
                    if (!string.IsNullOrEmpty(checkedValue))
                    {
                        writer.AddKnockoutDataBind("checkedValue", KnockoutHelper.MakeStringLiteral(checkedValue));
                    }    
                });
            }
            else
            {
                writer.AddKnockoutDataBind("checked", this, CheckedProperty, () => { });
            }

            // render the input tag
            writer.AddAttribute("type", "radio");

            var groupNameBinding = GetBinding(GroupNameProperty);
            if (groupNameBinding != null)
            {
                writer.AddKnockoutDataBind("attr", new[] { new KeyValuePair<string, IValueBinding>("name", groupNameBinding as IValueBinding) }, this, GroupNameProperty);
            }
            else
            {
                writer.AddAttribute("name", GroupName);
            }

            writer.RenderSelfClosingTag("input");
        }
开发者ID:holajan,项目名称:dotvvm,代码行数:36,代码来源:RadioButton.cs

示例8: 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();
        }
开发者ID:darilek,项目名称:dotvvm,代码行数:27,代码来源:BodyResourceLinks.cs

示例9: RenderBeginTag

 protected override void RenderBeginTag(IHtmlWriter writer, IDotvvmRequestContext context)
 {
     if (ButtonTagName == ButtonTagName.input)
     {
         writer.RenderSelfClosingTag(ButtonTagName.ToString());
     }
     else
     {
         base.RenderBeginTag(writer, context);
     }
 }
开发者ID:darilek,项目名称:dotvvm,代码行数:11,代码来源:Button.cs


注:本文中的IHtmlWriter.RenderSelfClosingTag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。