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


C# HtmlTags.HtmlTag类代码示例

本文整理汇总了C#中HtmlTags.HtmlTag的典型用法代码示例。如果您正苦于以下问题:C# HtmlTag类的具体用法?C# HtmlTag怎么用?C# HtmlTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HtmlTag类属于HtmlTags命名空间,在下文中一共展示了HtmlTag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Checkbox

 private static HtmlTag Checkbox(UIComponentContext context)
 {
     var checkbox = new CheckboxTag(context.Value<bool>()).Attr("value", "true");
     var hidden = new HtmlTag("input").Attr("type", "hidden").Attr("value", "false");
     checkbox.Next = hidden;
     return checkbox;
 }
开发者ID:marcusswope,项目名称:MVCConventions,代码行数:7,代码来源:ExampleInputConventions.cs

示例2: AddElementName

 public static void AddElementName(ElementRequest request, HtmlTag tag)
 {
     if (tag.IsInputElement())
     {
         tag.Attr("name", request.ElementId);
     }
 }
开发者ID:joshuaflanagan,项目名称:fubumvc,代码行数:7,代码来源:DefaultHtmlConventions.cs

示例3: AuthButtons

        public static MvcHtmlString AuthButtons(this HtmlHelper htmlHelper)
        {
            var authContainer =
                new HtmlTag("div")
                    .Attr("style", "overflow: hidden;")
                    .Append("input",
                            ht => ht.Id("authType").Attr("name", "authType").Attr("type", "hidden").Attr("value", "1"))
                    .Append("a",
                            ht => ht
                                      .Attr("href", "javascript:auth.signin('twitter')")
                                      .AddClasses("simpleAuthButton", "twitter")
                                      .Text("twitter"))
                    .Append("a",
                            ht => ht
                                      .Attr("href", "javascript:auth.signin('facebook')")
                                      .AddClasses("simpleAuthButton", "facebook")
                                      .Text("facebook"))
                    .Append("a",
                            ht => ht
                                      .Attr("href", "javascript:auth.signin('google')")
                                      .AddClasses("simpleAuthButton", "google")
                                      .Text("google"))
                    .ToHtmlString();

            return new MvcHtmlString(authContainer);
        }
开发者ID:smithkl42,项目名称:SimpleSocialAuth,代码行数:26,代码来源:HtmlExtensions.cs

示例4: TestEditorTag

        public TestEditorTag(FixtureLibrary library)
            : base("div")
        {
            AddClass("main");
            Add("h2").AddClass(HtmlClasses.TEST_NAME);
            Id("testEditor");

            AddClass(HtmlClasses.TEST_EDITOR);

            _container = Add("div").AddClasses("container", HtmlClasses.SECTION, "test-editor");

            FixtureGraph fixture = library.BuildTopLevelGraph();

            HtmlTag holder = new HolderTag(fixture).AddClass("top-level-holder");
            holder.Children.Last().Render(false);

            Container
                .MetaData(GrammarConstants.LEAF_NAME, GrammarConstants.TEST)
                .MetaData(GrammarConstants.FIXTURE, GrammarConstants.TEST)
                .MetaData(GrammarConstants.SELECTION_MODE, SelectionMode.OneOrMore.ToString())
                .Append(holder)
                .Append(new HtmlTag("hr"));

            Container.ActionLink(fixture.Policies.AddGrammarText, GrammarConstants.ADD_SECTION_ACTIVATOR);
            Container.Append(new GrammarSelector(fixture).Build());
        }
开发者ID:adymitruk,项目名称:storyteller,代码行数:26,代码来源:TestEditorTag.cs

示例5: mustache_attr

        public void mustache_attr()
        {
            var tag = new HtmlTag("a");
            tag.MustacheAttr("href", "url");

            tag.ToString().ShouldEqual("<a href=\"{{url}}\"></a>");
        }
开发者ID:kharlamov,项目名称:FubuMVC.Core.UI,代码行数:7,代码来源:HtmlTagExtensionsTester.cs

示例6: Build

 public override HtmlTag Build(ElementRequest request)
 {
     HtmlTag root = new HtmlTag("div").Attr("data-bind", "foreach: "+ CCHtmlConventions2.DeriveElementName(request));
     var child = new HtmlTag("div").Attr("data-bind", "text: $data" );
     root.Append(child);
     return root;
 }
开发者ID:reharik,项目名称:CannibalCoder,代码行数:7,代码来源:ListDisplayBuilder2.cs

示例7: Modify

        public virtual void Modify(HtmlTag form)
        {
            if (!_modify) return;

            form.Data("validation-mode", _value.ToLower());
            form.AddClass("validated-form");
        }
开发者ID:emiaj,项目名称:fubuvalidation,代码行数:7,代码来源:ValidationMode.cs

示例8: RenderAuthWarnings

        public static MvcHtmlString RenderAuthWarnings(this HtmlHelper htmlHelper)
        {
            var appSettingsKeys =
                new[]
                    {
                        "googleAppID", "googleAppSecret",
                        "facebookAppID", "facebookAppSecret",
                        "twitterConsumerKey", "twitterConsumerSecret"
                    };

            var noValueForSetting = appSettingsKeys
                    .Any(key => string.IsNullOrEmpty(ConfigurationManager.AppSettings[key]));

            var message = "";

            if (noValueForSetting)
            {
                message = new HtmlTag("p")
                        .Attr("style", "color: Red;")
                        .Text("Not all key and secrets are filled in a configuration file.")
                        .ToHtmlString();
            }

            return new MvcHtmlString(message);
        }
开发者ID:smithkl42,项目名称:SimpleSocialAuth,代码行数:25,代码来源:HtmlExtensions.cs

示例9: Build

        public override HtmlTag Build(ElementRequest request)
        {
            var tag = new HtmlTag("div").Text(request.StringValue()).AddClass("editable").Id(request.Accessor.Name);

            var options = new EditOptions();

            if (request.Accessor.HasAttribute<MarkdownAttribute>())
            {
                tag.UnEncoded().Text(new Markdown().Transform(request.RawValue== null ? "" : request.RawValue.ToString()));
                options.Markdown = true;
            }

            options.MultiLine = request.Accessor.Name == "Details";
            options.RequiresExplicitUserActionForSave = true;

            options.MaximumLength = request.Accessor.PropertyType.Equals(typeof(string)) ? Entity.UnboundedStringLength : 0;
            options.IsDate = request.Accessor.PropertyType.IsDateTime();
            options.IsTime = request.Accessor.Name.ToLower().Contains("time");
            options.IsNumber = request.Accessor.PropertyType.IsIntegerBased() || request.Accessor.PropertyType.IsFloatingPoint();
            options.Required = request.Accessor.HasAttribute<RequiredAttribute>();
            options.PlaceholderText = "Double-Click to edit " + request.Accessor.Name.ToLower() + ".";

            var data = options.ToJson();

            tag.Attr("data", "{editoptions:"+data+"}");
            return tag;
        }
开发者ID:rauhryan,项目名称:kokugen,代码行数:27,代码来源:EditInPlaceBuilder.cs

示例10: Build

 public override void Build(ElementRequest request, HtmlTag tag)
 {
     tag
         .AllTags()
         .Where(t => t.IsInputElement())
         .ForEach(t => t.AddClass("url"));
 }
开发者ID:phoenixwebgroup,项目名称:DotNetExtensions,代码行数:7,代码来源:UrlValidationModifier.cs

示例11: setDisabledState

 private static void setDisabledState(MenuItemToken item, HtmlTag link)
 {
     if (item.MenuItemState == MenuItemState.Disabled)
     {
         link.AddClass("disabled");
     }
 }
开发者ID:synhershko,项目名称:FubuMVC.Bootstrap,代码行数:7,代码来源:MenuItemTag.cs

示例12: ScriptTag

        public ScriptTag(string mode, Func<string, string> toFullUrl, Asset asset, string defaultUrl = null)
            : base("script")
        {
            // http://stackoverflow.com/a/1288319/75194 
            Attr("type", "text/javascript");

            if (asset == null)
            {
                Attr("src", toFullUrl(defaultUrl));
                return;
            }

            if (asset.CdnUrl.IsNotEmpty())
            {
                Attr("src", asset.CdnUrl);
                if (asset.FallbackTest.IsNotEmpty() && asset.File != null)
                {
                    Next = new HtmlTag("script");
                    var text = "if ({0}) document.write(unescape(\"%3Cscript src='{1}' type='text/javascript'%3E%3C/script%3E\"));".ToFormat(asset.FallbackTest, asset.Url);

                    Next.Encoded(false);
                    Next.Text(text);
                }

                return;
            }

            var url = asset.Url;
            if (mode.InDevelopment() && asset.File != null)
            {
                url += "?Etag=" + asset.File.Etag();
            }

            Attr("src", toFullUrl(url));
        }
开发者ID:kingreatwill,项目名称:fubumvc,代码行数:35,代码来源:ScriptTag.cs

示例13: get_conventions

        public ConventionsViewModel get_conventions()
        {
            var configTypes = new string[]
                   {
                       ConfigurationType.Settings,
                       ConfigurationType.Discovery,
                       ConfigurationType.Explicit,
                       ConfigurationType.Policy,
                       ConfigurationType.Attributes,
                       ConfigurationType.ModifyRoutes,
                       ConfigurationType.InjectNodes,
                       ConfigurationType.Conneg,
                       ConfigurationType.Attachment,
                       ConfigurationType.Navigation,
                       ConfigurationType.ByNavigation,
                       ConfigurationType.Reordering,
                       ConfigurationType.Instrumentation
                   };

            var tag = new HtmlTag("ul");
            configTypes.Each(configType => {
                tag.Add("li/a").Text(configType).Attr("href", "#" + configType);
            });


            return new ConventionsViewModel
            {
                Descriptions = new TagList(configTypes.Select(configType => new ConfigurationTypeTag(configType, _graph))),
                TableOfContents = tag
            };
        }
开发者ID:DarthFubuMVC,项目名称:FubuMVC.Diagnostics,代码行数:31,代码来源:ConventionsFubuDiagnostics.cs

示例14: TableTag

 public TableTag()
     : base("table")
 {
     _header = new HtmlTag("thead", this);
     _footer = new HtmlTag("tfoot", this).Render(false);
     _body = new HtmlTag("tbody", this);
 }
开发者ID:NTCoding,项目名称:FubuRaven.NTCoding.com,代码行数:7,代码来源:TableTag.cs

示例15: AddElementName

 public static void AddElementName(ElementRequest request, HtmlTag tag)
 {
     if (tag.IsInputElement())
     {
         tag.Attr(HtmlAttributeConstants.Name, request.ElementId);
     }
 }
开发者ID:phoenixwebgroup,项目名称:Accountability,代码行数:7,代码来源:HtmlConventions.cs


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