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.

List Bound Grid renders empty DIV

Thread ID:

Created:

Updated:

Platform:

Replies:

132266 Aug 23,2017 10:46 AM Aug 24,2017 03:20 AM ASP.NET MVC 1
loading
Tags: Grid
Jason Johnston
Asked On August 23, 2017 10:46 AM

Well, I'm trying to get started with the Syncfusion Grid and I'm off to a frustrating start.  I'm assuming this is something simple, as I'm not finding many other posts about this.  I copied the List binding demo and tweaked it.  However, despite everything working through the process, the EJ helper renders an empty <div> tag out to the browser.

Page Content:

            @(Html.EJ().Grid<uploadedFile>("FilesGrid")
        .Datasource(.Datasource((IEnumerable<object>)ViewBag.datasource))
        .AllowSorting()
        .AllowPaging()
        .IsResponsive()
        .Columns(col =>
        {
            col.Field("fileID").HeaderText("file ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
            col.Field("fileName").HeaderText("File Name").TextAlign(TextAlign.Right).Priority(4).Width(75).Add();
            col.Field("approvalID").HeaderText("approval ID").Width(80).Add();
            col.Field("fileContents").HeaderText("File Contents").TextAlign(TextAlign.Right).Priority(4).Width(75).Add();
            col.Field("comments").HeaderText("Comments").TextAlign(TextAlign.Right).Width(75).Priority(3).Format("{0:C}").Add();
            col.Field("uploadDate").HeaderText("Upload Date").TextAlign(TextAlign.Right).Width(80).Priority(2).Format("{0:MM/dd/yyyy}").Add();
            col.Field("uploadedBy").HeaderText("User").Width(110).Priority(2).Add();
            col.Field("fileHash").HeaderText("File Hash").TextAlign(TextAlign.Right).Priority(4).Width(75).Add();
            col.Field("fileType").HeaderText("File Type").TextAlign(TextAlign.Right).Priority(4).Width(75).Add();

        }))

Controller Code:

        public ActionResult FileListing()
        {

            using(FileUploadContext dbContext=new FileUploadContext())
            {
                ViewBag.datasource = dbContext.uploadedFiles.ToList();
            }

            return View();
        }


The controller populates the datasource with around ten record, which I can step through on a debug do indeed get picked up by the EJ.Grid constructor.  However, all that ever gets spit out to the page is:       "<div id="FilesGrid"></div>"

I have all scripts and them files located in the project.  Again, I'm sure it's something simple, but I'm not seeing it.
Any insight or help would be appreciated.

Renjith Singh Rajendran [Syncfusion]
Replied On August 24, 2017 03:20 AM

Hi Jason, 

We have analyzed your query, We suspect that you are using unobtrusive mode. To make use of Unobtrusive support with our Essential JavaScript components, it is necessary to refer the ej.unobtrusive.min.js file under the _Layout.cshtml in your application. The ej.unobtrusive.min.js script should be referred next to ej.web.all.min.js file reference since it is dependent on it. Please refer the code below, 

Web.config 
  <appSettings>  
    ... 
   <add key="UnobtrusiveJavaScriptEnabled" value="true" /> 
    ... 
 </appSettings> 

_Layout.cshtml 
<script src="~/Scripts/ej.unobtrusive.min.js"></script> 

If you are using non-unobtrusive mode, we suspect that you have not added the ScriptManager in _Layout.cshtml in your application. Please refer the code below. 

Web.config 
  <appSettings>  
    ... 
   <add key="UnobtrusiveJavaScriptEnabled" value="false" /> 
    ... 
 </appSettings> 

_Layout.cshtml 
<body> 
    @RenderBody() 
    @Html.EJ().ScriptManager(); 
</body> 

We have also prepared a sample based on your requirement, which can be downloaded from the following link, 

Please refer the documentation link below, 

Regards, 
Renjith Singh Rajendran. 


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.

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.

;