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. Image for the cookie policy date

Grid was not showing in MVC view

HI,

I am new in syncfusion, i need one help from you.

I have created one grid control in my view and it's get all the values in my action and that values are passing successfully passing to view, but grid was not showing in my view. And there is not getting any error...

That view was only showing "<div id="FlatGrid"></div>"

But sample project was working fine (Created by Essential Studio)

This is the Controller


This is the view


References


5 Replies

RU Ragavee U S Syncfusion Team January 19, 2016 05:00 AM UTC

Hi Nitheesh,

Thanks for your interest in Syncfusion Products.

The ASP.Net MVC Controls will render in two mode, they are
  • Unobtrusive mode
  • Non-unobtrusive mode.

The ASP.Net MVC Controls will render in Unobtrusive mode when setting the “UnobtrusiveJavascriptEnabled” as true in web.config file.

From the information that you have shared, we found out that your application is configured in non-unobtrusive mode. You can check in web.config file if the unobtrusive is enabled in your project as in the code example below.

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

For non-unobtrusive configured project, it is essential to define the script manager in the project in order to render the controls properly.

[In _Layout.html]

<body>

    @RenderBody()


    @RenderSection("scripts", required: false)

    @(Html.EJ().ScriptManager())
</body>


If your project is configured to Unobtrusive mode, then please refer to the below online documentation for more information.

http://help.syncfusion.com/aspnetmvc/getting-started#to-enable-unobtrusive-option-in-your-application

Regards,
Ragavee U S.


NI Nitheesh January 19, 2016 09:21 AM UTC

Hi Ragavee,

Good day!!!!

I have added <add key="UnobtrusiveJavaScriptEnabled" value="true" />  in my appSettings, but it's not displaying any thing in my view.

And also I have tried javascript, that was working fine.

When i add
@Html.EJ().DatePicker("MyFirstDatePicker")
it's only showing one text box not date picker like this
<input data-role="ejdatepicker" id="MyFirstDatePicker">
 
But using javascript it's working fine like this
<script type="text/javascript">
        $(function () {
            $("#datepick").ejDatePicker({width:"100%"});
        });
</script>
and output is
<span class="e-datewidget e-widget" style="width100%;" aria-invalid="false">
    <span class="e-in-wrap e-box e-padding">
        <input type="text" id="datepick" class="e-datepicker e-js e-input" tabindex="0" aria-atomic="true" aria-live="assertive" name="datepick" placeholder="Select date">
        <span id="datepick-img" class="e-select" style="displayblock;">
            <span class="e-icon e-date" aria-label="Select"></span>
        </span>
    </span>
</span>


And these are the scripts added in my view

<link rel='nofollow' href="~/Modules/Styles/web/default-theme/ej.widgets.all.min.css" rel="stylesheet" />
<script src="~/Modules/Scripts/jquery-1.10.2.min.js"></script>
<script src="~/Modules/Scripts/jsrender.min.js"></script>
<script src="~/Modules/Scripts/jquery.globalize.min.js"></script>
<script src="~/ModulesScripts/jquery.easing.1.3.min.js"></script>
<script src="~/Modules/Scripts/ej/ej.web.all.min.js"></script>
And this is my web.config settings

<appSettings>
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
        <add namespace="System.Linq"/>
        <add namespace="System.Collections.Generic"/>
        <add namespace="Orchard.Mvc.Html"/>
 
        <add namespace="Syncfusion.JavaScript" />
        <add namespace="Syncfusion.JavaScript.DataVisualization" />
        <add namespace="Syncfusion.MVC.EJ" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>
 
  <system.web>
    <compilation targetFramework="4.5.1">
      <assemblies>
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Web.Mvc, Version=5.2.3, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <add assembly="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
        <add assembly="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
 
        <add assembly="Syncfusion.EJ.Export, Version=13.3450.0.7, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" />
        <add assembly="Syncfusion.Compression.Base, Version=13.3450.0.7, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" />
        <add assembly="Syncfusion.EJ, Version=13.3450.0.7, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" />
        <add assembly="Syncfusion.EJ.Mvc, Version=13.3500.0.7, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" />
        <add assembly="Syncfusion.Linq.Base, Version=13.3450.0.7, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" />
        <add assembly="Syncfusion.XlsIO.Base, Version=13.3450.0.7, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" />
        <add assembly="Syncfusion.EJ.Olap,Version=13.3450.0.7, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" />
        <add assembly="Syncfusion.Olap.Base, Version=13.3450.0.7, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" />
      </assemblies>
    </compilation>
  </system.web>


Note : Only problem in MVC and this same controls are working fine in javascript


RU Ragavee U S Syncfusion Team January 20, 2016 04:29 AM UTC

Hi Nitheesh,

Good day to you too!!!

Initially you have set UnobtrusiveJavaScriptEnabled as false, but missed out to define script manager in _Layout.html file as mentioned in our previous update. Whereas, after enabling the UnobtrusiveJavaScriptEnabled option now, you have missed out to refer the ej.unobtrusive.min.js file in your application which is the cause of the issue.

We have explained about the two modes in our earlier update and the necessities for rendering the control in both the modes. So please ensure the provided steps has been followed in your project.

Refer to the below online documentation for creating a MVC project manually.

http://help.syncfusion.com/aspnetmvc/getting-started#mvc-4-application -> Manual Integration of Syncfusion MVC components into new/existing MVC applications

In order to avoid some uncertainties and difficulties in a usual Javascript environment, Unobtrustive Javascript support has been introduced. It is easier for the users to create Syncfusion components with basic level HTML tag-like structure.

When the UnobtrusiveJavaScriptEnabled option is set to true in the web.config file, the control usually renders with the HTML5 data attributes and also the reference to the ej.unobtrusive.min.js file needs to be included in the application.

If you explicitly set this UnobtrusiveJavaScriptEnabled option to false, then the control rendering takes place through scripts, which requires the usage of script manager in your application.

Refer to the Help Document for unobtrusive support.

http://help.syncfusion.com/js/unobtrusive-support

Regards,
Ragavee U S.


NI Nitheesh January 25, 2016 02:01 PM UTC

Hi Ragavee,

Good day!!!!

Thanks for the valuable replay......

Now it's working fine..... :)

Thanking you,
Nitheesh


GV Gowthami V Syncfusion Team January 26, 2016 04:30 AM UTC

Hi Nitheesh,
 
We are happy to hear that your has been resolved.
 
Get back to us if you need further assistance.
 
Regards,
 
Gowthami V.

Loader.
Up arrow icon