This is a migrated thread and some comments may be shown as answers.

Help with page loading multiple times...

1 Answer 204 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dennis
Top achievements
Rank 1
Dennis asked on 20 Nov 2012, 08:48 PM
I'm using asp.net mvc4 with kendo ui. I have a simple grid that gets loaded with no values on load (Index()) and then once a search button is clicked data populates the grid(Index(int value)). Here's what I've found so far. I think the problem is how I have my .js files arranged but I'm not positive. I already built one app and it works correctly and I had a problem with how to arrange the .js files. The other issue seems to be with Areas in the MVC application. I have to add a _ViewStart under all my ares under the Views folder or there is no formatting. In my _viewstart file I have @{   Layout = "~/Views/Shared/_Layout.cshtml";}. If I comment that out the page loads correctly but there is no data. If I include it to layout my page it calls the correct method and returns data but it also calls the Index() method and load a blank Model and clears out my results. 

Here's my _Layout:
 @Styles.Render("~/Content/css")
    @Styles.Render("~/Content/kendo")
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/kendo")
    @Scripts.Render("/bundles/jqueryval")

Bundles
 bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-1.8.2.js"));
bundles.Add(new ScriptBundle("~/bundles/kendo").Include(
                 "~/Scripts/kendo/2012.3.1114/kendo.all.*"
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/modernizr-2.5.3.js",
                        "~/Scripts/jquery.validate.min.js",
                         "~/Scripts/jquery.unobtrusive*"));


Thanks
Dennis

1 Answer, 1 is accepted

Sort by
0
Dennis
Top achievements
Rank 1
answered on 21 Nov 2012, 04:48 PM
I'm using asp.net mvc4 with kendo ui. I have a simple grid that gets loaded with no values on load (Index()) and then once a search button is clicked data populates the grid(Index(int value)). Here's what I've found so far. I think the problem is how I have my .js files arranged but I'm not positive. I already built one app and it works correctly and I had a problem with how to arrange the .js files. The other issue seems to be with Areas in the MVC application. I have to add a _ViewStart under all my ares under the Views folder or there is no formatting. In my _viewstart file I have @{   Layout = "~/Views/Shared/_Layout.cshtml";}. If I comment that out the page loads correctly but there is no data. If I include it to layout my page it calls the correct method and returns data but it also calls the Index() method and load a blank Model and clears out my results. it seems if I place @Scripts.Render("~/bundles/jquery") below @Scripts.Render("~/bundles/kendo") the grid works but not the menu. If I place jquery bundle above kendo the menu works and not the grid. The grid will keep firing the method but it won't if I reverse the order.

Here's my _Layout:
 @Styles.Render("~/Content/css")
    @Styles.Render("~/Content/kendo")
    @Styles.Render("~/Content/themes/base/css")
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/bundles/jqueryui")
        @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/kendo")

Bundles:
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                 "~/Scripts/jquery-1.8.2.min.js"));

             bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/modernizr-2.5.3.js",
                        "~/Scripts/jquery.validate.min.js",
                         "~/Scripts/jquery.unobtrusive-ajax.min.js"));

             bundles.Add(new ScriptBundle("~/bundles/kendo").Include(
                  //"~/Scripts/kendo/2012.3.1114/kendo.web.min.js",// or kendo.all.* if you want to use Kendo UI Web and Kendo UI DataViz
                  //"~/Scripts/kendo/2012.3.1114/kendo.dataviz.min.js",
                  //"~/Scripts/kendo/2012.3.1114/kendo.menu.min.js",
                  //"~/Scripts/kendo/2012.3.1114/kendo.grid.min.js"
                  
                  //"~/Scripts/kendo/2012.3.1114/kendo.dropdownlist.min.js"
            //bundles.Add(new ScriptBundle("~/bundles/kendo").Include(
            "~/Scripts/kendo/2012.3.1114/kendo.all.*"// or kendo.all.* if you want to use Kendo UI Web and Kendo UI DataViz
               
                ));

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

            // The Kendo CSS bundle
            bundles.Add(new StyleBundle("~/Content/kendo").Include(
                    "~/Content/kendo/2012.3.1114/kendo.common.*",
                    "~/Content/kendo/2012.3.1114/kendo.default.*",
                    "~/Content/kendo/2012.3.1114/kendo.dataviz.*"));

            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));

            bundles.Add(new StyleBundle("~/Content/css").Include(
                    "~/Content/site.css"));


            bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
                        "~/Content/themes/base/jquery.ui.core.css",
                        "~/Content/themes/base/jquery.ui.resizable.css",
                        "~/Content/themes/base/jquery.ui.selectable.css",
                        "~/Content/themes/base/jquery.ui.accordion.css",
                        "~/Content/themes/base/jquery.ui.autocomplete.css",
                        "~/Content/themes/base/jquery.ui.button.css",
                        "~/Content/themes/base/jquery.ui.dialog.css",
                        "~/Content/themes/base/jquery.ui.slider.css",
                        "~/Content/themes/base/jquery.ui.tabs.css",
                        "~/Content/themes/base/jquery.ui.datepicker.css",
                        "~/Content/themes/base/jquery.ui.progressbar.css",
                        "~/Content/themes/base/jquery.ui.theme.css"));




            // Clear all items from the default ignore list to allow minified CSS and JavaScript files to be included in debug mode
            bundles.IgnoreList.Clear();

            // Add back the default ignore list rules sans the ones which affect minified files and debug mode
            bundles.IgnoreList.Ignore("*.intellisense.js");
            bundles.IgnoreList.Ignore("*-vsdoc.js");
            bundles.IgnoreList.Ignore("*.debug.js", OptimizationMode.WhenEnabled);
        }
    }
}


Thanks
Dennis
Tags
General Discussions
Asked by
Dennis
Top achievements
Rank 1
Answers by
Dennis
Top achievements
Rank 1
Share this question
or