This is a migrated thread and some comments may be shown as answers.

Samples that are not samples, Fix the Documentation

3 Answers 313 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pat Tormey
Top achievements
Rank 1
Pat Tormey asked on 23 Apr 2013, 02:32 PM
I'm trying to learn to use the Kendo grid.
So I went to  http://demos.kendoui.com/web/grid/index.html
Where the Basic Usage shows columns First Last City Title Birthdate

And here is the code for that under index.cshtml.

@model IEnumerable<Kendo.Mvc.Examples.Models.ProductViewModel>

@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.ProductID).Groupable(false);
columns.Bound(p => p.ProductName);
columns.Bound(p => p.UnitPrice);
columns.Bound(p => p.UnitsInStock);
})
.Groupable()
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Products_Read", "Grid"))
)
)

I'm finding your MVC docs obtuse enough without this kind of help.

Same story on Binding to remote data.
The DataSource calls an read method that isn't in the Remote_DataController.cs

I really want to love your product..  So help me out fix the documentation.

Pat NH USA

3 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 24 Apr 2013, 08:31 AM
Hello,

These source files are added just for reference so you can get the basic idea how to achieve the same with the MVC wrappers. 
Actually this is the source code from the MVC wrappers offline demos which you should have available under the following folder:

C:\Program Files (x86)\Telerik\Kendo UI for ASP.NET MVC Q2 2012\Examples


Note : 
Please download sample demo from below link and let me know which kind of functionality you want in it.

http://jayeshgoyani.blogspot.in/2013/01/set-column-editable-mode-based-on_16.html

GridController
using System.Collections.Generic;
using System.Data.Linq;
using System.Linq;
using System.Web.Mvc;
using Kendo.Mvc.Examples.Models;
using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
using System;
 
namespace Kendo.Mvc.Examples.Controllers
{
    public partial class GridController : Controller
    {
        public ActionResult Index()
        {
            return View(GetProducts());
        }
 
        public ActionResult Remote_Data()
        {
            return View("AjaxBinding");
        }
 
        public ActionResult Products_Read([DataSourceRequest] DataSourceRequest request)
        {
            return Json(GetProducts().ToDataSourceResult(request));
        }
 
        private static IEnumerable<OrderViewModel> GetOrders()
        {
            var northwind = new NorthwindDataContext();
 
            var loadOptions = new DataLoadOptions();
 
            loadOptions.LoadWith<Order>(o => o.Customer);
            northwind.LoadOptions = loadOptions;
 
            return northwind.Orders.Select(order => new OrderViewModel
            {
                ContactName = order.Customer.ContactName,
                OrderDate = order.OrderDate,
                OrderID = order.OrderID,
                ShipAddress = order.ShipAddress,
                ShipCountry = order.ShipCountry,
                ShipName = order.ShipName,
                EmployeeID = order.EmployeeID
            });
        }
 
        private static IEnumerable<ProductViewModel> GetProducts()
        {
            var northwind = new NorthwindDataContext();
 
            return northwind.Products.Select(product => new ProductViewModel
            {
                ProductID = product.ProductID,
                ProductName = product.ProductName,
                UnitPrice = product.UnitPrice ?? 0,
                UnitsInStock = product.UnitsInStock ?? 0,
                UnitsOnOrder = product.UnitsOnOrder ?? 0,
                Discontinued = product.Discontinued,
                LastSupply = DateTime.Today
            });
        }
 
        private static IEnumerable<EmployeeViewModel> GetEmployees()
        {
            var northwind = new NorthwindDataContext();
 
            return northwind.Employees.Select(employee => new EmployeeViewModel
            {
                EmployeeID = employee.EmployeeID,
                FirstName = employee.FirstName,
                LastName = employee.LastName,
                Country = employee.Country,
                City = employee.City,
                Notes = employee.Notes,
                Title = employee.Title,
                Address = employee.Address,
                HomePhone = employee.HomePhone
            });
        }
    }
}


Thanks,
Jayesh Goyani
0
Nathan
Top achievements
Rank 2
answered on 27 May 2013, 09:40 PM
Now in: 
C:\Program Files (x86)\Telerik\Kendo UI for ASP.NET MVC Q1 2013\wrappers\aspnetmvc\Examples\Models

Took me 45 minutes to find this.

The Models are used in half the data-based examples.  They need to be easier to find.

Multiply 45 minutes by how many customers you have, assume an hourly rate of £100 / $100 an hour an hour and work out how much money making this hard to find is costing.  That's all money people can't spend on Telerik products.  Probably hundreds of thousands of £/$s.
0
Atanas Korchev
Telerik team
answered on 28 May 2013, 02:31 PM
Hello,

 The Models directory is the default place for storing  model classes in ASP.NET MVC applications. By default Visual Studio creates this folder and puts the authentication related model classes in there. 

 We have also documented the contents of the sample application.

Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Pat Tormey
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Nathan
Top achievements
Rank 2
Atanas Korchev
Telerik team
Share this question
or