コード例 #1
0
        public override string Render()
        {
            if (Filter != null && Filter.Filter(RowData))
            {
                return(string.Empty);
            }
            var a = new TagBuilder("a");

            a.AddCssClass(CssClass);
            a.Attributes["trButton"] = Id;
            a.SetInnerText(Name);
            if (!OnClick.IsNullOrEmpty())
            {
                a.Attributes.Add("onclick", FormatAttribute(OnClick));
            }
            if (!Href.IsNullOrEmpty())
            {
                a.Attributes.Add("href", FormatAttribute(Href));
            }
            else
            {
                a.Attributes.Add("href", "javascript:void(0);");
            }
            a.Attributes.Add("target", "_{0}".FormatTo(Target.ToString().ToLower()));
            return(a.ToString());
        }
コード例 #2
0
        protected override void Render(TagHelperContext context, TagHelperOutput output)
        {
            base.Render(context, output);

            output.SetTagName("a");

            if (ListGroupContext != null && ListGroupContext.IsRenderAsDiv != true)
            {
                ListGroupContext.IsRenderAsDiv = true;
            }

            if (!IsDisabled)
            {
                if (Href.IsNullOrEmpty())
                {
                    Href = "#";
                }
                output.Attributes.SetAttribute("href", UrlHelper.Content(Href));
            }
            else
            {
                output.MergeAttribute("href", "javascript:void(0)");
            }
        }