Пример #1
0
        public static MvcHtmlString ShowMsg(this HtmlHelper helper, string msg = null)
        {
            if (msg.IsNullOrEmpty())
            {
                msg = helper.ViewBag.Msg;
            }

            if (msg.IsNullOrEmpty())
            {
                return(new MvcHtmlString(string.Empty));
            }

            return
                (new MvcHtmlString(
                     "<script>showMsg('{0}');</script>".Formatting(JavaScriptSupport.EscapeSpecialCharacters(msg))));
        }
Пример #2
0
        public static MvcHtmlString ShowErrorMsg(this HtmlHelper helper, string msg = null)
        {
            if (msg.IsNullOrEmpty())
            {
                msg = helper.ViewBag.ErrorMsg;
            }

            if (msg.IsNullOrEmpty())
            {
                return(new MvcHtmlString(string.Empty));
            }

            return
                (new MvcHtmlString(
                     "<script>$(function(){showError('" + JavaScriptSupport.EscapeSpecialCharacters(msg) +
                     "')});</script>"));
        }