I follow the kendo demo, and I check the data was return list of data to view, but finally the grid have not display any row.
View
@(Html.Kendo().Grid<ProductListModel>()
.Name("grid")
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("RowTemplate_Read","Product").Type(HttpVerbs.Get))
)
.Scrollable()
)
Controller
[HttpGet]
public ActionResult RowTemplate_Read([DataSourceRequest] DataSourceRequest request)
{
var productList = GetAllProduct().Select(e => new ProductListModel{Name = e.NameChi, Id = e.Id });
return Json(productList.ToDataSourceResult(request));
}
Here is the page and error view:
http://postimg.org/image/dx0cyu5n1/ http://postimg.org/image/9ptdejo9t/
17-Nov-2013 Finally I find out the problem is DTO, I can not directly use it for binding, Anyone can tell me the reason?!
DTO CODE:
public class ProductDTO : DTO
{
[MaxLength(50)]
public string NameChi { get; set; }
[MaxLength(50)]
public string NameEng { get; set; }
public decimal Price { get; set; }
public string DescriptionChi { get; set; }
public string DescriptionEng { get; set; }
public bool IsPublic { get; set; }
[ForeignKey("Product_Brand")]
public BrandDTO Brand { get; set; }
[ForeignKey("Brand")]
public int BrandId { get; private set; }
public string MainPhotoPath { get; set; }
[ForeignKey("ProductCategory")]
public int ProductCategoryId { get; private set; }
[ForeignKey("Product_ProductCategory")]
public ProductCategoryDTO ProductCategory { get; set; }
[ForeignKey("ProductType")]
public int ProductTypeId { get; private set; }
[ForeignKey("Product_ProductType")]
public ProductTypeDTO ProductType { get; set; }
public List<PhotoDTO> PhotosPaths { get; set; }
public List<TagDTO> Tags { get; set; }
public List<GalleryDTO> Galleries { get; set; }
}