c# - Special character in the parameter of Read action method of Html.Kendo Grid -
i have master detailed html kendo grid master grid set model id primary key column. primary key column may have special character e.g. a&12345. on master grid row expand event, detail grid data load call sent
$(gridname).data("kendogrid").datasource.read();
and read action of html kendo grid follow
.read(read => read.action("getgriddata", "gridcontroller", new { filterparameter = "#=filterparametervalue#" }))
in above read action filterparametervalue contains special character mentioned above i-e.
a&12345
now in network traffic can see a&12345 being passed when controller action method, showing me in parameter value , else getting truncated.
following network
/gridcontroller/getgriddata?filterparameter=a&12345 http post 200 application/json 0.64 kb 55.50 s xmlhttprequest 10108 0 16 55490 0 676295
can't figure out doing wrong here. advice appreciated.
the thing "&" character understood browser if passed variable. understand :
/gridcontroller/getgriddata?filterparameter=a&mydata=toto
so need encode value.
try :
.read(read => read.action("getgriddata", "gridcontroller", new { filterparameter = uri.escapedatastring("#=filterparametervalue#") }))
i'm not sure if it's rigth escape method, haven't tested piece of code.
Comments
Post a Comment