Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
85
Having a difficult time time loading resources.... Please help :-)
posted

BACKGROUND:  I'm using ASP.NET MVC4, .NET 4.0.

  If I load some resources using the MVC HTML Helper methods and some resources I load at run-time based on user input,  what should I use to ensure all of those resources are available to my application on the client side?

    I have a page that loads and shows a treeview and combo.  I'm using the MVC HTML Helper methods to show these items.   The data comes from the model.  This is working, both the treeview and combo show.

  When the user has selected criteria on the page,   I perform an ajax call to retrieve json data.  Once the json data is retrieved I can either show it in a grid, or show it in a chart, depending on the report data.

  I am able to show the data in a grid,  but I cannot get the chart to work .  I am getting the Javascript error...  Uncaught TypeError: Object [object Object] has no method 'igDataChart'

Here is the code i'm using to ensure my resources exist;    This is the first call on the page (index.cshtml).   I noticed if I move this into the HEAD tag of  the _Layout.cshtml nothing works!     What the heck???

@(Html.Infragistics().Loader().ScriptPath(Url.Content("~/Scripts/IG/js/")).CssPath(Url.Content("~/Content/IG/css")).Resources("igTree,igCombo,igGrid.*,igEditors,igDataChart.*").Render())

Why aren't the resources for the igDataChart being loaded??????????  Arghhh

Below is what is in the HEAD tag of my _Layout.cshtml. 

<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />

<link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />


<!--jQuery from CDN-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js" type="text/javascript"></script>

<!--jQuery UI from CDN-->
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.js" type="text/javascript"></script>

<!--Modernizr from CDN. For css-boxsizing support build a custom version here: http://modernizr.com/download/-->
<script src="http://www.modernizr.com/downloads/modernizr-latest.js" type="text/javascript"></script>

<script src="@Url.Content("~/Scripts/AjaxLogin.js")" type="text/javascript"></script>

<!--igniteUI Combined JavaScript-->
<script src="@Url.Content("~/Scripts/IG/js/Infragistics.loader.js")" type="text/javascript"></script>

<script src="http://ajax.aspnetcdn.com/ajax/knockout/knockout-2.2.1.js" type="text/javascript"></script>

  • 23953
    Offline posted

    Hello Rob,

    Rob McElroy said:
    Here is the code i'm using to ensure my resources exist;    This is the first call on the page (index.cshtml).   I noticed if I move this into the HEAD tag of  the _Layout.cshtml nothing works!     What the heck???

    This is a limitation: The MVC Loader does not function properly in an MVC Razor layout view.

    Rob McElroy said:
    Why aren't the resources for the igDataChart being loaded??????????  Arghhh

    Did you check with a browser developer tools that the igDataChart files are not loaded? Sometimes the code which instantiates the widget is executed before the widget files are loaded.

    Rob McElroy said:
    @(Html.Infragistics().Loader().ScriptPath(Url.Content("~/Scripts/IG/js/")).CssPath(Url.Content("~/Content/IG/css")).Resources("igTree,igCombo,igGrid.*,igEditors,igDataChart.*").Render())

    This code is OK. I checked it in my test project. It's loading the igDataChart resources in MVC 4 project.

    Overall, I don't have any specific guesses what the problem can be. Can you provide a sample, so I can investigate it.

    Best regards,
    Martin Pavlov
    Infragistics, Inc.