Ejemplo n.º 1
0
        public static System.Web.Mvc.MvcHtmlString Script(this HtmlHelper helper, ScriptRef scriptReference, bool throwException = false)
        {
            if (ResourceHelper.TryConfigureScriptManager(scriptReference))
            {
                return(System.Web.Mvc.MvcHtmlString.Empty);
            }

            var resourceKey = scriptReference.ToString();
            var context     = helper.ViewContext.HttpContext;
            var resourceUrl = ResourceHelper.GetWebResourceUrl(scriptReference);

            if (string.IsNullOrEmpty(resourceUrl))
            {
                return(System.Web.Mvc.MvcHtmlString.Empty);
            }

            return(ResourceHelper.RegisterResource(context, resourceKey, resourceUrl, throwException));
        }
Ejemplo n.º 2
0
        public static MvcHtmlString Script(this HtmlHelper helper, ScriptRef scriptReference, bool throwException = false)
        {
            if (ResourceHelper.TryConfigureScriptManager(scriptReference))
            {
                return(MvcHtmlString.Empty);
            }

            var resourceKey = scriptReference.ToString();
            var context     = helper.ViewContext.HttpContext;
            var resourceUrl = ResourceHelper.GetWebResourceUrl(scriptReference);

            if (string.IsNullOrEmpty(resourceUrl))
            {
                throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Script reference for {0} is not found.", resourceKey));
            }

            return(ResourceHelper.RegisterResource(context, resourceKey, resourceUrl, throwException));
        }