Hello,
I'm almost at loading data from the api controller. I've got a controller that returns Json from a IEnumerable<Utenti> (POCO object)
I got this exception
Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1502: The best overloaded method match for 'Kendo.Mvc.UI.Fluent.WidgetFactory.Grid(System.Data.DataTable)' has some invalid arguments
Source Error:
Line 7: <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
Line 8:
Line 9: <% Html.Kendo().Grid(Model)
Line 10: .Name("Grid")
Line 11: .AutoBind(true)
my aspx is
<% Html.Kendo().Grid(Model) //
.Name("Grid")
.AutoBind(true)
//.Columns(columns =>
//{
// columns.Bound(x => x.IDUtente);
// columns.Bound(x => x.Nominativo);
// columns.Bound(x => x.Societa);
// columns.Bound(x => x.Filiale);
// columns.Bound(x => x.Ruolo);
// //columns.Bound(p => p.).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("GetListaUtenti", "Administration");
})
).Render();
%>
My controller is
[HttpPost]
public ActionResult GetListaUtenti([DataSourceRequest] DataSourceRequest request)
{
// if (!System.Web.HttpContext.Current.User.Identity.IsAuthenticated) throw new SecurityExeption();
DataAccessAdministration da = new DataAccessAdministration(Global.IDApplication, IDIstituto);
int idUser = 185560;
var res = da.GetListaUtenti(idUser);
return Json(res);
}
And the Utente item is of that type
[DataContract]
public class Utente
{
[DataMember]
public int IDIstituto { get; set; }
[DataMember]
public int IDDipendente { get; set; }
[DataMember]
public string IDUtente { get; set; }
[DataMember]
public string Nominativo { get; set; }
[DataMember]
public string Filiale { get; set; }
[DataMember]
public string Societa { get; set; }
[DataMember]
public string Ruolo { get; set; }
[DataMember]
public string Profilo { get; set; }
[DataMember]
public string Funzioni { get; set; }
[DataMember]
public string Stato { get; set; }
[DataMember]
public int IDStato { get; set; }
[DataMember]
public int IDFunzione { get; set; }
[DataMember]
public int IDProfilo { get; set; }
[DataMember]
public Guid? SFGuid { get; set; }
}
What should I put in the aspx in order to get data loaded?
Thanks
I'm almost at loading data from the api controller. I've got a controller that returns Json from a IEnumerable<Utenti> (POCO object)
I got this exception
Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1502: The best overloaded method match for 'Kendo.Mvc.UI.Fluent.WidgetFactory.Grid(System.Data.DataTable)' has some invalid arguments
Source Error:
Line 7: <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
Line 8:
Line 9: <% Html.Kendo().Grid(Model)
Line 10: .Name("Grid")
Line 11: .AutoBind(true)
my aspx is
<% Html.Kendo().Grid(Model) //
.Name("Grid")
.AutoBind(true)
//.Columns(columns =>
//{
// columns.Bound(x => x.IDUtente);
// columns.Bound(x => x.Nominativo);
// columns.Bound(x => x.Societa);
// columns.Bound(x => x.Filiale);
// columns.Bound(x => x.Ruolo);
// //columns.Bound(p => p.).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("GetListaUtenti", "Administration");
})
).Render();
%>
My controller is
[HttpPost]
public ActionResult GetListaUtenti([DataSourceRequest] DataSourceRequest request)
{
// if (!System.Web.HttpContext.Current.User.Identity.IsAuthenticated) throw new SecurityExeption();
DataAccessAdministration da = new DataAccessAdministration(Global.IDApplication, IDIstituto);
int idUser = 185560;
var res = da.GetListaUtenti(idUser);
return Json(res);
}
And the Utente item is of that type
[DataContract]
public class Utente
{
[DataMember]
public int IDIstituto { get; set; }
[DataMember]
public int IDDipendente { get; set; }
[DataMember]
public string IDUtente { get; set; }
[DataMember]
public string Nominativo { get; set; }
[DataMember]
public string Filiale { get; set; }
[DataMember]
public string Societa { get; set; }
[DataMember]
public string Ruolo { get; set; }
[DataMember]
public string Profilo { get; set; }
[DataMember]
public string Funzioni { get; set; }
[DataMember]
public string Stato { get; set; }
[DataMember]
public int IDStato { get; set; }
[DataMember]
public int IDFunzione { get; set; }
[DataMember]
public int IDProfilo { get; set; }
[DataMember]
public Guid? SFGuid { get; set; }
}
What should I put in the aspx in order to get data loaded?
Thanks