This is a migrated thread and some comments may be shown as answers.

Absolute url for ajax data CrudOperationBuilder configuration example?

1 Answer 122 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 29 Jul 2013, 09:10 AM
Hi, 
   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 
[AllowCrossSite]
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();
    AddImages(model);
    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. 

Thanks 

David 

1 Answer, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 31 Jul 2013, 08:08 AM
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
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or