How to set datasource URL property to relative URL?

2 posts, 1 answers
  1. Laksh
    Laksh avatar
    25 posts
    Member since:
    Mar 2011

    Posted 10 Apr 2015 Link to this post

    I have MVC application which has Kendo grid. The datasource's URL property is set to /Users/GetRequests . The application runs fine locally in visual studio. In production the application is hosted under virtual directory 

    So when we deploy application to production its not working with the url /Users/GetRequests, however if i change the url to /Dashboard/Users/GetRequests then it works but then it will not work locally. 

    How can i set the relative URL to datasource?

    $(document).ready(function () {
        $.ajaxSetup({ cache: false });
                dataSource: new{
                        read: {
                            url: "/Users/GetRequests",
                            dataType: "json"
                    pageSize: 10
                pageable: {
                    refresh: true,
                    pageSizes: [5,10,15,20]
                    { title: "Request Type", field: "RequestType", width: 85 },
                    { title: "Requested On", field: "RequestedOn", width: 75 }

  2. Answer
    Kiril Nikolov
    Kiril Nikolov avatar
    2543 posts

    Posted 14 Apr 2015 Link to this post

    Hello Laksh,

    The dataSource.transport.url option accept a function, that you can use to dynamically return different url whenever read is executed. Please check the following documentation article that I believe will help:

    Kiril Nikolov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top