I have a controller that returns an HttpResponseMessage.
I then create a simple page and try to load a grid. For the life of me, I have not been able to make it work. I know the service returns data. But I can't even see the call in Google chrome. It just shows the grid with no data. I have tried many combinations in the schema. I place a break point on the Get() method and it doesn't get there. :-(
Thank you so much,
Carlos
public HttpResponseMessage Get()
{
return GetByEnteredDate(Convert.ToDateTime("10/16/2013"));
}
public HttpResponseMessage GetByEnteredDate(DateTime enteredDate)
{
return GetByEnteredDates(enteredDate.Date, enteredDate.Date.Add(new TimeSpan(23, 59, 0)));
}
public HttpResponseMessage GetByEnteredDates(DateTime fromDate, DateTime thruDate)
{
var licenses =
(from li in repository.All
where !li.Deleted
&& li.DateEntered >= fromDate
&& li.DateEntered <= thruDate
select li).ToList();
if(licenses != null && licenses.Any())
{
return Request.CreateResponse<
IEnumerable
<LicenseDto>>(HttpStatusCode.OK,
mapper.Map<
IEnumerable
<Hialeah.License.Domain.License>, IEnumerable<
LicenseDto
>>(licenses));
}
throw new HttpResponseException(HttpStatusCode.NotFound);
}
I then create a simple page and try to load a grid. For the life of me, I have not been able to make it work. I know the service returns data. But I can't even see the call in Google chrome. It just shows the grid with no data. I have tried many combinations in the schema. I place a break point on the Get() method and it doesn't get there. :-(
<
div
id
=
"licensesGrid"
></
div
>
<
script
type
=
"text/javascript"
>
$(document).ready(function () {
var licenseDataSource = new kendo.data.DataSource({
transport: {
read: {
url: "api/licenses",
datatype: "json"
}
},
schema: {
data: function (response) {
return response.Data;
}
},
pageSize: 10
});
$("#licensesGrid").kendoGrid({
datasource: licenseDataSource,
pageable: true,
sortable: true
});
});
</
script
>
Thank you so much,
Carlos