here is part of my code
this
<%= Html.ActionLink(Model[x].Title, "Index", "q", new { slug = Model[x].TitleSlug, id = Model[x].PostID }, null)%>
produces this url
http://localhost:61158/q/is_there_another_indiana_jones_movie_in_the_works/4
but I want to produce a url with a fragment, like this:
http://localhost:61158/q/is_there_another_indiana_jones_movie_in_the_works/4#1
Is there a way to do this using the HTML.ActionLink function?
There are two “mega overloads” of ActionLink that take a fragment parameter:
See MSDN for more info on the overloads.
In your case it would be (and note the “fragment” parameter in particular):
With the “mega overloads” you can leave most parameter values as null and they will get the appropriate default values.