have created a simple .aspx page to show a grid. My requirement is that the entire data should not be loaded at first (except for the first page) but when user clicks on next page and so on the data should come from an API
.
I have created the same code as given in the documentation. Now the problem is that the API is called but at the end it includes a forward slash before the query string. You can see below:
The following is my code.
HTML:
<div id="grid"></div>
JAVASCRIPT:
var dataManager = ej.DataManager({
url:"/api/Designs",
adaptor: new ej.WebApiAdaptor()
});
$("#grid").ejGrid({
dataSource: dataManager,
allowPaging: true
});
C# API:
using Some.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;
namespace Some.Sales
{
public class DesignsController : ApiController
{
// GET api/design
public object Get()
{
var queryString = HttpContext.Current.Request.QueryString;
int skip = Convert.ToInt32(queryString["$skip"]);
int take = Convert.ToInt32(queryString["$top"]);
var designs = new DesignRepository().GetDesignAll().ToList();
return new {
Items = designs.Skip(skip).Take(take),
Count = designs.Count
};
}
}
}
Where i am doing wrong, please help me out.