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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Create Grid and bind to Model.

Thread ID:

Created:

Updated:

Platform:

Replies:

121292 Nov 28,2015 01:07 AM UTC Nov 30,2015 07:06 AM UTC ASP.NET MVC 1
loading
Tags: Grid
SyncfusionUser1020
Asked On November 28, 2015 01:07 AM UTC

Hello

I am trying to create an ASP.NET MVC grid which binds to a model but it doesn't seem to render. I have used the VS extension to convert the project to Syncfusion MVC and have the following code:

Controller:

 [HttpGet]
        public ActionResult Create1()
        {   

        List<Customer_Customer> C = new List<Customer_Customer>();
                // add in items.

            return View(C);
        }

View:
@model IEnumerable<SyncfusionWebTest.Models.Customer_Customer>

@using System.Web.Mvc.Html;
@using Syncfusion.MVC.EJ;
@using Syncfusion.JavaScript;

@{
    ViewBag.Title = "Create1";
}

<h2>Create1</h2>

<div>
    @{(Html.EJ().Grid<SyncfusionWebTest.Models.Customer_Customer>("FlatGrid")
                        .Datasource((IEnumerable<SyncfusionWebTest.Models.Customer_Customer>)Model)
                        .AllowSorting()
                        .AllowPaging()
                        .Columns(col =>
                        {
                            col.Field(model => model.FirstName).HeaderText("a").IsPrimaryKey(true).Width(75).Add();
                            col.Field(model => model.LastName).HeaderText("a").Width(80).Add();

                        })).Render();
    }

//Test- This part is visible and contains data.
    @foreach (var item in Model)
    {
        <div>
            @Html.DisplayFor(modelItem => item.FirstName)
        </div>
        <div>
            @Html.DisplayFor(modelItem => item.LastName)
        </div>
    }
</div>



Also, I notice in the demo that you render two sections called "ControlsSection" and "SampleHeading" what are these used for and do I need to use these in my code? If so where do I find the scripts?

Thank You

Sellappandi Ramu [Syncfusion]
Replied On November 30, 2015 07:06 AM UTC

Hi Patrick,

Thanks for contacting Syncfusion support.

Query #1: I am trying to create an ASP.NET MVC grid which binds to a model but it doesn't seem to render. I have used the VS extension to convert the project to Syncfusion MVC and have the following code:

We have tested the reported issue at our end using your codes, but it’s working fine. Please share the following information to us for short out the cause of the issue and provide the prompt solution.

1.       Check once whether Dll’s and Scripts are referred correctly, please clear the browser cache once and reload the sample.
2.       Screen shot of the network post, it will help us to found the any console error throws on loading.
3.       Kindly send us issue reproducing sample, it will help us to found the cause of the issue.
4.       Are you using the following VS extension to create the MVC project?


Please refer to the attached sample in below,


Sample: http://www.syncfusion.com/downloads/support/forum/121292/ze/MVCGrid_121292-1237216792


Query #2: Also, I notice in the demo that you render two sections called "ControlsSection" and "SampleHeading" what are these used for and do I need to use these in my code? If so where do I find the scripts? 


We have used these two section for sample browser samples demo. These sections are not important to render the controls.


Scripts are referred in _Layout.cshtml file under Views/Shared folder and the scripts are located in Scripts/ej folder.


Regards,

Sellappandi R


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

;