We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Render Grid when UnobtrusiveJavaScriptEnabled is TRUE

Thread ID:

Created:

Updated:

Platform:

Replies:

123549 Mar 30,2016 01:27 AM UTC Apr 6,2016 04:37 AM UTC ASP.NET MVC 4
loading
Tags: Grid
Cindy Kee
Asked On March 30, 2016 01:27 AM UTC

I am trying to use the MVC Grid control in an existing MVC5 project. I have to keep UnobtrusiveJavaScriptEnabled to true in order for the rest of the website to work.
I have added the CDN for the ej.unobtrusive.min.js file with the other scripts links thatare required in the scripts section of the webpagethat I am using Syncfusion on:
@section scripts {





@Scripts.Render("~/Scripts/edit-consignments.js")
}

I didn't include the main jquery file on this page because it is included in the _Layout page. I took out the ScriptManager, as instructed.
I get the Grid Headers rendered but no data. So I tried a ListBox on the page instead, and all I get is a box outline. If I turn off UnobtrusiveJavaScriptEnabled in the web.config and add in the ScriptManager, it works. But I can't turn this off for the entire site - I need it everywhere but this page.
How do I get this to work?
Cindy

Cindy Kee
Replied On March 30, 2016 01:28 AM UTC

When I posted the question, I lost the scripts section of my file. Here it is again:

@section scripts {
    <script src="http://cdn.syncfusion.com/js/assets/external/jquery.easing.1.3.min.js"></script>
    <script src="http://cdn.syncfusion.com/js/assets/external/jsrender.min.js"></script>
    <script src="http://cdn.syncfusion.com/js/assets/external/jquery.globalize.min.js"></script>
    <script src="http://cdn.syncfusion.com/13.4.0.63/js/web/ej.web.all.min.js"></script>

    <script src="http://cdn.syncfusion.com/13.4.0.63/js/common/ej.unobtrusive.min.js"></script>

    @Scripts.Render("~/Scripts/edit-consignments.js")
}

Gowthami V [Syncfusion]
Replied On March 30, 2016 11:30 AM UTC

Hi Cindy,

Thanks for using Syncfusion products.

We have analyzed your issue and we suspect that you may refer the script files after the grid has rendered. So that only the grid is not rendered.

We can resolve the issue by set the “InitUnobtrusiveInScriptManager” as “true” under appSettings in web.config as follows,

web.config


<appSettings>

    . . . .

    . . . .

    <add key="UnobtrusiveJavaScriptEnabled" value="true"/>

    <add key="InitUnobtrusiveInScriptManager" value="true"/>
 </appSettings>

_Layout.cshtml

<body>
. . . .

. . . .

@RenderSection("scripts", required: false)


@Html.EJ().ScriptManager()     @*At last call ScriptManager method*@

   

</body>


While using above solution we need to call the ScriptManager method in _Layout.cshtml page.

The scripts will be referred based on the ScriptManager method placed in the _Layout.cshtml. So refer all the scripts before the ScriptManager method.

For your convenience we have created a sample and the same can be referred from the following link,

http://www.syncfusion.com/downloads/support/directtrac/123549/SAE851~1222382020.ZIP

If we misunderstood your issue please provide us the more details about your issue like the script error details thrown in console (developer tool) which will help to analyze the issue and provide you the response as early as possible..

Regards,

Gowthami V.


Cindy Kee
Replied On April 5, 2016 11:05 PM UTC

Thank you! That worked!

The 2 key things I was missing was the new key in the web.config (<add key="InitUnobtrusiveInScriptManager" value="true"/>) and then making sure the ScriptManager comes AFTER the all of the scripts.

I integrated those changes into my test project, and now things work with the UnobtrusiveJavaScriptEnabled set to true.  :)

Thanks again,
Cindy


Ragavee U S [Syncfusion]
Replied On April 6, 2016 04:37 AM UTC

Hi Cindy,

Thanks for your update.

We are happy that your requirement is achieved.

Regards,
Ragavee U S.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;