Reputation: 18859
I have this action link:
@Html.ActionLink("Export to Excel", // link text
"Export", // action
"Members", // controller
Request.QueryString, // query string
"excel"); // class
Using my own overloaded Action Link method:
public static MvcHtmlString ActionLink(this HtmlHelper htmlHelper,
string linkText, string action, string controllerName,
NameValueCollection queryString, string className)
{
var newRoute = new RouteValueDictionary();
IDictionary<string, object> htmlAttributes =
new Dictionary<string, object> {{"class", className}};
newRoute = htmlHelper.ViewContext.HttpContext.Request.QueryString.ToRouteDic(newRoute);
return HtmlHelper.GenerateLink(htmlHelper.ViewContext.RequestContext,
htmlHelper.RouteCollection, linkText, null, action, null,
newRoute, htmlAttributes).ToMvcHtml();
}
So this is the url of the page on my on:
mysite.com/Members?searchName=&searchEmail=&agencyId=&agencyTypeId=®ionId=®ionId=67&searchTaxIdNum=&searchDateStart=&searchDateEnd=
And the Action Link I have generates this url:
mysite.com/Members/Export?regionId=%2C67
So for some reason %2C
is getting added to the regionId
, but I'm not sure. Anyone know what I'm doing wrong?
Upvotes: 0
Views: 303
Reputation: 5573
%2 in a URL is equivalent to a blank space, you probably have a blank space somewhere in your code.
Upvotes: 2