This question is locked. New answers and comments are not allowed.
Hi
I am using telerik version 2011.2.726.
I have a page that contains a popup grid which is populated and appears when a button is clicked.
initialization of the telerik window and Grid occur through java script using grid. rebind.
Everything is working as expected until the search parameter ( PropertyTypeKey) for the grid Data contains a "/" slash character, which causes a HTTP error 405 to be returned.
I have run the search data through encodeURIComponent before passing it as a parameter to the grid rebind function, but the grid functionality seems to be decoding it, and the slash is then reappearring in the URL, and a routing error is occurring.
The gris is set up as an Ajax bound grid:
The OnRentListPopupdataBind function is defined as:
Stepping through the code, the (config.codevalue) value in the onPopupDataBind prototype contains the correctly encoded value( which as data goes something like "AC/P AUS" ), but the URL being called comes out as something like
SelectAjaxRent/AC/P%20%20%20AUS which looks like the Encoded value has been decoded and then escaped,
retaining the coding for spaces but not the "/".
Controller method is:
So what is the correct way of handling the "/" character to ensure that the data is not being treated as a URL / Route?
Thanks
I am using telerik version 2011.2.726.
I have a page that contains a popup grid which is populated and appears when a button is clicked.
initialization of the telerik window and Grid occur through java script using grid. rebind.
Everything is working as expected until the search parameter ( PropertyTypeKey) for the grid Data contains a "/" slash character, which causes a HTTP error 405 to be returned.
I have run the search data through encodeURIComponent before passing it as a parameter to the grid rebind function, but the grid functionality seems to be decoding it, and the slash is then reappearring in the URL, and a routing error is occurring.
The gris is set up as an Ajax bound grid:
@(Html.Telerik().Grid<LandAssist.DataTransfer.PropertyTypeRentDto>() .Name("RentPopupGrid") .ClientEvents(events => { events.OnDataBinding("onRentListPopupDataBind"); }) .DataBinding(dataBinding => dataBinding.Ajax() .Select("SelectAjaxRent",@ViewBag.RouteValue) .Insert(""PropertyTypeDefault"", @ViewBag.RouteValue) .Update(""PropertyTypeDefault"", @ViewBag.RouteValue) .Delete(""PropertyTypeDefault"", @ViewBag.RouteValue)) .DataKeys(keys => keys.Add(c => c.PropertyTypeKey)) .Columns(columns =>....... var propertyKey = encodeURIComponent('@Model.PropertyTypeKey'); var propertyTitle = encodeURIComponent('@Model.DisplayName');function onRentListPopupDataBind(args) { if (firstRent) { args.preventDefault(); firstRent = false; } else codesApi.onPopupDataBind( { args: args, codevalue: propertyKey, gridName: '#RentPopupGrid' } );}and codesApi.prototype.onPopupDataBind = function (options) { var config = $.extend({ gridName: '#PopupGrid' }, options); //new data input for controller csll - needed to keep paging on the same id var grid = $('#PopupGrid').data('tGrid'); config.args.data = $.extend(config.args.data, { search: config.codevalue});}Stepping through the code, the (config.codevalue) value in the onPopupDataBind prototype contains the correctly encoded value( which as data goes something like "AC/P AUS" ), but the URL being called comes out as something like
SelectAjaxRent/AC/P%20%20%20AUS which looks like the Encoded value has been decoded and then escaped,
retaining the coding for spaces but not the "/".
Controller method is:
[GridAction] public virtual ActionResult SelectAjaxRent(string search) { return View(new GridModel(this.commonService.GetPropertyTypeRentDtoList(HttpUtility.UrlDecode(search)))); }So what is the correct way of handling the "/" character to ensure that the data is not being treated as a URL / Route?
Thanks