This question is locked. New answers and comments are not allowed.
When you have a grid with prefixes turned on, the querystring parameters that are generated end up having hyphens in the name. This becomes VERY unfriendly to Views who wish to use these parameters for server-side functionality (sort/paging/filtering/etc.).
How can we change this behavior or work around it? I have found a workaround that works for strings but nothing that allows me to keep the data as strongly-typed data (i.e. bringing in the page number as an integer 1 rather than as a string "1").
For what it's worth, my work-around is this:
protected override void OnActionExecuting(ActionExecutingContext filterContext) |
{ |
var keys = filterContext.HttpContext.Request.QueryString.AllKeys.Where(k => k.Contains('-')); |
foreach (var key in keys) |
{ |
filterContext.ActionParameters[key.Replace('-', '_')] = filterContext.HttpContext.Request.QueryString[key]; |
} |
base.OnActionExecuting(filterContext); |
} |