Example #1
0
        /// <summary>
        /// 创建链接按钮。
        /// </summary>
        /// <returns>返回链接按钮实例。</returns>
        protected TagBuilder CreateAnchor()
        {
            var anchor = new TagBuilder("a");

            if (Enabled == EnabledMode.Multi)
            {
                anchor.MergeAttribute("js-enabled", "1+");
            }
            else if (Enabled == EnabledMode.Single)
            {
                anchor.MergeAttribute("js-enabled", "1");
            }
            if (!string.IsNullOrEmpty(Href))
            {
                anchor.MergeAttribute("href", Href);
                anchor.MergeAttribute("js-mode", "nav");
            }
            else if (!string.IsNullOrWhiteSpace(Action))
            {
                anchor.MergeAttribute("js-mode", "action");
                anchor.MergeAttribute("href", Action);
            }
            else if (!string.IsNullOrEmpty(Modal))
            {
                anchor.MergeAttribute("href", Modal);
                anchor.MergeAttribute("js-mode", "modal");
            }
            else
            {
                anchor.MergeAttribute("href", "javascript:;");
            }
            if (!string.IsNullOrWhiteSpace(Confirm))
            {
                anchor.MergeAttribute("js-confirm", Confirm);
            }
            if (!string.IsNullOrWhiteSpace(ExcludeIds))
            {
                anchor.MergeAttribute("js-excluded", $",{ExcludeIds.Trim()},");
            }
            if (IgnoreChecked)
            {
                anchor.MergeAttribute("js-ignore", "checked");
            }
            return(anchor);
        }