コード例 #1
0
        private static string CreateImageAnchor(string href, string src,
                                                string title = "", string target = "")
        {
            if (string.IsNullOrWhiteSpace(href))
            {
                return(string.Empty);
            }
            if (string.IsNullOrWhiteSpace(src))
            {
                return(string.Empty);
            }
            href = VotePage.NormalizeUrl(href);
            src  = VotePage.NormalizeUrl(src);
            var a = new HtmlAnchor
            {
                HRef   = href,
                Title  = title,
                Target = target
            };

            new HtmlImage {
                Src = src
            }.AddTo(a);
            return(a.RenderToString());
        }
コード例 #2
0
        private string GetOfficeClassLinkOrText(string stateCode,
                                                OfficeClass officeClass, bool allIdentified, string countyCode = "",
                                                string localCode = "")
        {
            var text = GetOfficeClassDescription(officeClass);

            if (allIdentified)
            {
                return(text);
            }

            var a = new HtmlAnchor
            {
                HRef      = GetOfficePageUrl(stateCode, officeClass, countyCode, localCode),
                Target    = "office",
                InnerHtml = text
            };

            return(a.RenderToString());
        }
コード例 #3
0
        public static string CreateWebAnchor(string href, string anchorText = "",
                                             string title = "", string target = "")
        {
            if (string.IsNullOrWhiteSpace(href))
            {
                return(string.Empty);
            }
            if (string.IsNullOrWhiteSpace(anchorText))
            {
                anchorText = href;
            }
            href = VotePage.NormalizeUrl(href);
            var a = new HtmlAnchor
            {
                HRef      = href,
                InnerHtml = anchorText,
                Title     = title,
                Target    = target
            };

            return(a.RenderToString());
        }