Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why isn't my Scripts.RenderSection working for jqGrid?

I am using Visual Studio 2012 and MVC 4, and in my _Layout.cshtml, I have the following:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width" />
        @Styles.Render("~/Content/css")
        @Scripts.Render("~/bundles/jquery")
        @Scripts.Render("~/bundles/jqueryui")
        @Scripts.Render("~/bundles/jqgrid")

        @RenderSection("head", required: false)
    </head>
    <body>
        @RenderBody()

        @RenderSection("scripts", required: false)
    </body>
</html>

and in the BundleConfig.cs I have

public class BundleConfig
{
    public static void RegisterBundles(BundleCollection bundles)
    {
        bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
            "~/Scripts/jquery-{version}.js"));

        bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
            "~/Scripts/jquery-ui-{version}.js"));

        bundles.Add(new ScriptBundle("~/bundles/jqgrid").Include(
            "~/Scripts/jquery.jqGrid.min.js"));
    }
}

I've triple checked and my scripts folder does indeed contain jquery.jqGrid.min.js, but it's not being included.

My Html head looks like:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <link href="/Viper/Content/css" rel="stylesheet"/>

    <script src="/Viper/Scripts/jquery-1.8.1.js"></script>

    <script src="/Viper/Scripts/jquery-ui-1.8.23.js"></script>

</head>

Any ideas why this is not being added?

like image 596
Scottie Avatar asked Jun 27 '26 23:06

Scottie


1 Answers

The default behavior when debug=true is to ignore *.min.js(this is something we are looking at fixing).

For now, the easiest thing to do is would be to rename your file to be jquery.jqGrid.js

like image 187
Hao Kung Avatar answered Jun 30 '26 18:06

Hao Kung



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!