Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4540272
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:03:47+00:00 2026-05-21T15:03:47+00:00

I am using the following code (taken from a Stackoverflow post: Action Image MVC3

  • 0

I am using the following code (taken from a Stackoverflow post: Action Image MVC3 Razor ) in an HTML extension helper to build an action link. My Url.Action() method is returning a url that has the routeValues both in the route as well as appended onto the url like so:

/Proposals/List/Tabled?id=Tabled

when what I want is just

/Proposals/List?id=Tabled

Any suggestions about why it wants to do this?

Update:

A route rule from my Global.asax file. That must be why it’s doing it, but why it’s getting doubled up is still a mystery to me.

routes.MapRoute( _
    "ProposalsList", _
    "Proposals/List/{status}", _
    New With {.controller = "Proposals", .action = "List", .status = "Pending"} _
    )

Update:

Here is my call to the method, and I added the method definition to the code below.

@Html.ActionImage("Proposals", "List", New With {.id = Model.StatusFilter}, "~/images/" + Model.ImageFile, "Count", 32, 32, Model.ProposalsCount.ToString + " " + Model.StatusFilter + " Proposal(s)")

Here is my code:

    <Extension()> _
    Public Function ActionImage(ByVal html As HtmlHelper, ByVal controller As String, ByVal action As String, ByVal routeValues As Object, ByVal imagePath As String, ByVal alt As String, ByVal width As Integer, ByVal height As Integer, ByVal text As String) As MvcHtmlString                
            Dim url = New UrlHelper(html.ViewContext.RequestContext)
            Dim imgHtml As String
            Dim anchorHtml As String
            Dim imgbuilder = New TagBuilder("img")

            imgbuilder.MergeAttribute("src", url.Content(imagePath))
            imgbuilder.MergeAttribute("alt", alt)
            imgbuilder.MergeAttribute("width", width)
            imgbuilder.MergeAttribute("height", height)
            imgHtml = imgbuilder.ToString(TagRenderMode.SelfClosing)

            Dim anchorBuilder = New TagBuilder("a")
            anchorBuilder.MergeAttribute("href", url.Action(action, controller, routeValues))
            anchorBuilder.InnerHtml = imgHtml + "<br/>" + text
            anchorHtml = anchorBuilder.ToString(TagRenderMode.Normal)

            Return MvcHtmlString.Create(anchorHtml)
    End Function
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T15:03:48+00:00Added an answer on May 21, 2026 at 3:03 pm

    When you pass routeValues to the url.action method it will use the values to override the currently defined ones (in the request context for the current page).

    So when the current status is Tabled and you do not reset that in the new routeValues you pass, then it will still use it..

    But since you pass an id as well it adds that too..

    You need to pass New With {.id = Model.StatusFilter, .status = nothing}

    the hierarchy is (from http://forums.asp.net/t/1328683.aspx)

    1. Values specified in the Url.Action call, then
    2. Values specified in the request context for the current page, then
    3. Default values for the route.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Following is the code snippets taken from http://pietschsoft.com/post/2011/09/09/Tag-Editor-Field-using-jQuery-similar-to-StackOverflow.aspx // pre-selected tags values: [ 'javascript',
the following code snippet taken from http://perldoc.perl.org/perlrequick.html#Search-and-replace gives me Bareword found where operator expected
The following code was taken from the ASP.NET page class (using Reflector): Public Custom
I'm using the following code on my iPhone app, taken from here to extract
The following code taken from: Java code for using google custom search API .
Well I am using the following code to take any old image into a
I am using following code to get bitmap from url. This function is used
Hi I have the following bubble sort algorithm (generic code taken from another site)
The following code is taken from Project Silk (a Microsoft sample application) The publish
This is a bit different. The following code was taken from a javascript script.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.