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 7025905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:02:46+00:00 2026-05-28T00:02:46+00:00

I am using @html.Actionlink() to build a link which redirects to an action in

  • 0

I am using @html.Actionlink() to build a link which redirects to an action in another controller(not the original controller with view) Below is my statement.

@Html.ActionLink(@orderNumber.ToString().Trim(), "SearchResult", "OrderStatus", @orderNumber.ToString(), new { target = "_self" })

but on clicking on the view i get an exception:

The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies)     could have been removed, had its name changed, or is temporarily     unavailable.  Please review the following URL and make sure that it is spelled correctly. 

Requested URL: /OrderStatus/SearchResult

though i have a controller with name OrderStatus having an action with name SearchResult

Am i missing some syntax?

searchresult method:

[AcceptVerbs("POST")]
public ActionResult SearchResult(FormCollection collection)
    {
        try
        {
            string orderNumber = collection["searchItem"].ToString();

            if (string.IsNullOrEmpty(orderNumber))
                return View("OrderStatusSearch");

            ////obtain sales oder header for paased order number
            #region sales order header
            orderNumber = orderNumber.Trim();

            ObjectParameter[] parameters = new ObjectParameter[1];
            parameters[0] = new ObjectParameter("OrderNumber", orderNumber);

            var headerQuery = dbContext.ExecuteFunction<Models.SalesOrderHeader>("uspGetHeaderDetails", parameters);

            Models.SalesOrderHeader salesOrderHeader = new Models.SalesOrderHeader();
            salesOrderHeader = headerQuery.SingleOrDefault();

            ////// return empty view if sales ordr header is null
            if (salesOrderHeader == null)
                return View("EmptySearch");
            #endregion
             ....................

            ////create sales order to be passed to view
            #region Create Sales Order
            {
                Models.SalesOrder salesOrder = new Models.SalesOrder();

                salesOrder.salesOrderHeader = salesOrderHeader;
                 ..................
                return View(salesOrder);
            }
            #endregion
        }
        catch (Exception e)
        {
            return View("EmptySearch");
        }
    }
  • 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-28T00:02:46+00:00Added an answer on May 28, 2026 at 12:02 am

    It looks like there may be one or two things wrong.

    1) Are you sure are using the correct Html.ActionLink overload?

    You are using the overload that is expecting Html.ActionLink([link text], [action], [controller], [route values], [htmlAttributes]) and all you’ve given for the route values is a string. This needs to be a RouteValueDictionary or an anonymous object, not just a string. Try this below, does this work as you expect?

    @Html.ActionLink(@orderNumber.ToString().Trim(), "SearchResult", "OrderStatus", new{ id = @orderNumber.ToString() }, new { target = "_self" })
    

    I assume you want it to generate a URL such as /OrderStatus/SearchResult/999 where 999 is whatever order number you have. Is this right?

    2) Your SearchResult ActionResult only accepts a POST. Clicking on a hyperlink generated by the ActionLink will result in a GET. Since you don’t have a Controller/Action by these names that accepts a GET, a 404 is the expected result.

    If the link your ActionLink generates points to /OrderStatus/SearchResult[/order number] then an appropriate action method would have to look like (assuming default routing configuration):

    public ActionResult SearchResult(string orderNumber) { ... }
    

    You could prefix it with the attribute [HttpGet] if you wanted this action to only allow GETs, but this is not required.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to include a link in my SiteMaster (using Html.ActionLink) UNLESS the view
When using ActionLink to render data from database which has HTML tags (ie <p>)
Form @using (Html.BeginForm(new { id=form})) { //fields} Link <div align=center id=submitLink>@Html.ActionLink(Next, address, PES, new
I want to get just the link to a route. Using Html.ActionLink and Html.RouteLink
ASP.NET MVC can generate HTML elements using HTML Helpers, for example @Html.ActionLink() , @Html.BeginForm()
I'm using HTML emails for a client's newsletter. Not using HTML mails is not
I am using @Html.ActionLink(Home, Home) to currently pass back to Home when clicked. However,
Instead of using Html.ActionLink to load subpages into MainContent, I would like to load
I've got the following View <% Using Html.BeginForm()%> <%: Html.ValidationSummary(True) %> <div class=displayright> <h3>
I want to do autopostback to dropdownlist. My form on view: @using (Html.BeginForm(Index, Model,

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.