We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

WebAPI not working

Thread ID:

Created:

Updated:

Platform:

Replies:

125168 Jul 27,2016 03:04 AM Jul 28,2016 08:24 AM JavaScript 1
loading
Tags: ejGrid
Shaikh Zaki Mohammed
Asked On July 27, 2016 03:04 AM

I 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.



Prasanna Kumar Viswanathan [Syncfusion]
Replied On July 28, 2016 08:24 AM

Hi Mohammed, 

Thanks for contacting Syncfusion support. 

We checked with our sample with the given code snippet and we unable to reproduce the mentioned issue. 

To reproduce the issue we need the following details, 

1. Did you face the same issue in other browsers? 

2. Essential Studio Version details. 

3. If possible, reproduce the issue in the attached sample. 


Regards, 
Prasanna Kumar N.S.V 
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;