Absolute url for ajax data CrudOperationBuilder configuration example?

2 posts, 0 answers
  1. David
    David avatar
    6 posts
    Member since:
    Jun 2013

    Posted 29 Jul 2013 Link to this post

       I am remotely consuming a grid hosed in an MVC application. For the most part I have got it working as I am using template fields for the allot of things. 

    I am parsing some of the elements in a method that calls to controller which renders the grid as a partial view. I then spit this out into a literal control in an aspx page. 

    I need to be able to get the pager functionality calling the ajax data  source with an absolute url rather than the relative one it currently uses. 

    so this is my data source action 
    public ActionResult FallsDataSource([DataSourceRequest] DataSourceRequest request, string casenote)
        IList<FallsAssessEventDTO> events = bedmanEvents.GetEvents(casenote, BedmanEventType.FallsRiskAssessment).Cast<FallsAssessEventDTO>().ToList();
        var model = events.Select(e => (FallsAssessment)e).ToList();
        var queryable = model.AsQueryable();
        return Json(model.ToDataSourceResult(request));
    below is the ajax datasource configuration 

    datasource.Ajax().Read(read => read.Url("http://" + Request.Url.Host).Action("FallsDataSource", "FallsAssessment", new { Casenote = ViewBag.Casenote }))).Pageable()

    I was looking at the Url method on the CrudOperationBuilder but unsure how to use this properly. 


  2. Vladimir Iliev
    Vladimir Iliev avatar
    2194 posts

    Posted 31 Jul 2013 Link to this post

    Hi David,

    The URL method expects the full URL to be passed as string - please check the example below:

    .Read(read => read.Url("http://someAddress.com/Home/Read").Data("additionalDataFunction"))

    Also please note that the Action method should be removed in this case as it will override the URL passed to the URL method. 
    Kind Regards,
    Vladimir Iliev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top