I have an MVC Razor page where I am trying to add a querystring parameter to the URL.

<td>                
     @Html.ActionLink(item.Student_Name, "Index", "FourCourseAuditDetails", 
           new { filterByStudent = item.Student_Name})
</td>

My desired outcome is: http://[server]/FourCourseAuditDetails/Index?filterByStudent="[item.Student_Name]", but when I test out the page, the anchor href attirubte looks like this: http://[server]/[route of current view]?length=[integer value]

According to the Intellsense and the Html.ActionLink descriptions, I am using the correct arguments, but clearly something is not right.

The thing that came to mind is that item.Student_Name is a string that contains spaces and commas. I tried filterByStudent = item.Student_Name.toString(), which didn't help. I still think that's the cause of the problem, but I don't know what else I can do. Any ideas?

Related posts

Recent Viewed