Exemple #1
0
        public Anchor(string id, string name, string href, string text, AnchorTarget target = AnchorTarget.Self, string style = "")
            : base(id, name, ElementNames.Anchor, style)
        {
            if (string.IsNullOrWhiteSpace(href) || string.IsNullOrWhiteSpace(text))
            {
                throw new ArgumentNullException("Either href or text is null.");
            }

            _href   = href;
            _text   = text;
            _target = target;
        }
        public static string ToHtml(this AnchorTarget target)
        {
            if (target == AnchorTarget.Blank)
            {
                return("_blank");
            }

            if (target == AnchorTarget.Parent)
            {
                return("_parent");
            }

            if (target == AnchorTarget.Top)
            {
                return("_top");
            }

            return("_self");
        }