@model IEnumerable<GMSWeb.Models.SearchResults.OrgResults>
and here is my grid.
Html.EJ().Grid<GMSWeb.Models.SearchResults.OrgResults>("ResultGrid")
.Datasource(Model.)
.AllowSorting()
.AllowPaging()
.Columns(col =>
{
col.Field("OrgNo").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
col.Field("Name").HeaderText("Organisation Name").TextAlign(TextAlign.Right).Add();
}
)
)
NB: I'm not using all the columns in my model.
But I'm getting anything being rendered, not even an error.
I have two questions.
How do I define the datasource for the grid so it uses my IEnumerable model object ?
Where on this site are the class properties, methods and events for all these controls?
Examples are good but I'm flying blind not knowing anything about this Grid class.
Josef
.Datasource(Model.)
.AllowSorting()
.AllowPaging()
.Columns(col =>
{
col.Field("OrgNo").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
col.Field("Name").HeaderText("Organisation Name").TextAlign(TextAlign.Right).Add();
}
)
)
Query 1: “Getting anything being rendered, not even an error”
We have analyzed your sample and the issue is not reproduced. Please refer the following steps which may resolve the issue in your sample.
<head> <meta charset="utf-8" /> …. <script src="~/Scripts/ej/ej.web.all.min.js"></script> <script src="~/Scripts/ej/ej.unbotrusive.min.js"></script>
</head> |
[_Layout.cshtml] <head> … </head> <body> @RenderBody() … @Html.EJ().ScriptManager() … </body> |
Query 2: “Define the datasource for the grid”
As in the code example that you have shared, we need to pass View Model value to the “DataSource” Property of Grid Control.
@using MVCSampleBrowser.Models; @model IEnumerable<EditableOrder>
@(Html.EJ().Grid<EditableOrder>("FlatGrid") .Datasource(Model) .AllowPaging() .Columns(col =>
…
) |
Regards,
Manisankar Durai.
@model IEnumerable<GMSWeb.Models.SearchResults.OrgResults>
@if (Model != null)
{
@*<table class="table table-bordered table-hover">
<thead style="background-color:Beige">
<tr>
<td>Org ID</td>
<td>Organisation Name</td>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(x => item.OrgNo)
</td>
<td>
@Html.DisplayFor(x => item.Name)
</td>
</tr>
}
</tbody>
</table>*@
@(
Html.EJ().Grid<GMSWeb.Models.SearchResults.OrgResults>("ResultGrid")
.Datasource(Model)
.Columns(col=>
{
col.HeaderText("header");
col.HeaderText("OtherHeader");
}
)
);
}
else
{
<h4>No Matches found.</h4>
}
@*@section script
{
<script type="text/javascript">
$('.table > tbody > tr').on('click', function () {
});
</script>
}*@
Again nothing is displayed no errors , nothing.
4.
In regard to the zip file you sent me. I have installed the code into VS2013. However, the version of the MVC library required by Nuget is no longer available from your organisation and the following error occurs.
Error 1 NuGet Package restore failed for project MvcApplication6: Unable to find version '13.4.0.53' of package 'Syncfusion.AspNet.Mvc3'.. 0 0
5.
Thank you for sending me the following links .
However Online Sample Link: “http://mvc.syncfusion.com/demos/web/grid” is not a valid link.
6.
I find it extremely difficult to navigate from your examples to the classes used in you examples
eg. Examples of using the Grid in MVC are here
http://help.syncfusion.com/aspnetmvc/grid/data-binding#remote-data
but the java code and classes are here
http://help.syncfusion.com/js/api/ejgrid#members:datasource
would it not be better to place links from one to the other?
In the Microsoft MSDN class definitions are followed by examples but yours appear to be widely spread.
When I tried to search for the class for the ejgrid from this Grid example area here http://help.syncfusion.com/aspnetmvc/grid/getting-started no matches were returned. So I had to contact support. if it were easier to find that would reduce the time you need to spend in replying to questions.
regards
Josef
Query 1: “Nothing is displayed no errors”
We have analyzed your code example and we are unable to reproduce the issue. Could you please send us the following information so that we could sort out the cause of the issue and provide you a response as early as possible?
We have created a sample without using nuget packages that can be downloadable from below link.
http://www.syncfusion.com/downloads/support/forum/122082/ze/SyncfusionMvcApplication5-767293532
For resolving issues with Nuget packages please refer the response under Query 3.
Query 2: “online sample link is not valid”
Sorry for the inconvenience. We have mistakenly provided you a wrong link which is the cause for the invalid link.
Kindly check the below link for the online sample.
Online Sample Link: http://mvc.syncfusion.com/demos/web/grid
Query 3: “MVC library required by Nuget is no longer available”
This reported issue occurred since Syncfusion NuGet Package source may disabled or it was not configured in your Visual Studio. Please Enable/Configure it before restore the Syncfusion NuGet Packages in your Visual Studio.
Please refer the below link to configure Syncfusion NuGet Package source to your Visual Studio.
http://help.syncfusion.com/extension/syncfusion-nuget-packages/nuget-install-and-configuration
If you have already configured the Syncfusion NuGet Package Source and it was disabled, you can enable the Syncfusion Package source from Visual Studio -> Tools ->Library Package Manager->Package Manager Settings->Package Sources. Check whether the Syncfusion package source is checked or not. If it is unchecked please check it.
Please refer the screenshot for more information.
Now the required Syncfusion Packages will be restored successfully. If still you have faced same issue kindly update your Visual Studio details (Help->About) to us to proceed further.
Note: If you have configured Syncfusion NuGet Packages from local, please ensure that the packages are available in that location.
Query 4: “Documentation on Class properties, Events and Methods”
Please refer the following link for the list of class properties in MVC
http://help.syncfusion.com/cr/cref_files/aspnetmvc/ejmvc/Syncfusion.EJ~Syncfusion.JavaScript.Models.GridProperties.html
We have only provided the list of class properties for MVC and currently we have not provided description for the properties since it is currently in drafting status. We will update the class properties Description with examples, and control events for MVC in 2016 Vol 1 release which is expected to be rolled out at end of March 2016
As of now please refer the following JS documentation
http://help.syncfusion.com/js/api/ejgrid
In JS documentation, the members and events names are in camel case (first letter is in small case) whereas the equivalent MVC control name would be in pascal case (first letter would be capitalized).
Please check the below table for further clarification,
[In Javascript]
<script> $("#Grid").ejGrid({ … allowPaging:true }); </script> |
[In MVC]
@(Html.EJ().Grid<EditableOrder>("FlatGrid") … .AllowPaging() … ); |
[Index.cshtml] <div id="partial"></div> <script type="text/javascript"> window.onload= function() { $.ajax ({ url: "/Home/Partial", type: 'GET', success: function (data) { $("#partial").html(data); ej.widget.init($("#partial")); // when unobstrusive Is true. } [In Controller] public ActionResult Partial() { var DataSource = new NorthwindDataContext().EmployeeViews.ToList(); return PartialView("_PartialView", DataSource); } |
[In _PartialView.cshtml] @using Sample; @model IEnumerable<EmployeeView> @if (Model != null) { … @(Html.EJ().Grid<EmployeeView>("CustomGrid") .Datasource(Model) … ); } … @Html.EJ().ScriptManager() |
From the screenshot that you have been shared, the Syncfusion JavaScript and ASP.NET MVC packages source configured properly.
If you have already updated the Syncfusion package in packages.xml file in your project then it will be restored automatically when project compilation.
If you are going to install Syncfusion NuGet in your project. Then right click on project and choose Manage NuGet Packages for Solution | Online | <Package Source Name>. The NuGet Packages are listed which has presented in package source location. Install required packages to application by clicking Install button. Please refer below screenshot for more information.
If you have faced any difficulties with these please share us the issue replication procedures and screenshot.
Query 3: “sample continues to not work”
We are unable to reproduce the issue. Have you faced this issue while using nuget in sample or the sample without using nugget?
If without using nuget please ensure whether you have Syncfusion dlls in GAC location with the build version 13.4.0.53. If still you face the dll reference issue, please refer it from the GAC to avoid the issue.
Please find the following path to ensure that “C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Syncfusion.EJ\v4.0_13.4450.0.53__3d67ed1f87d44c89”
Query 4: “EXAMPLE USES VIEWBAG AND I REQUIRE ASSISTANCE USING A TYPED DATASET”
In the previous response we have updated a Sample with the code example using model binding in “View-> Home-> Index.cshtml”. We suspect that you have referred “View->Grid->Gridfeatures.cshtml”.
For your convenience, we have created a simple sample with partial view to repopulate the data using the ajax call. Please find the sample from the below link,
http://www.syncfusion.com/downloads/support/forum/122082/ze/Sample_1222032028
Regards,
Manisankar Durai.