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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:53:09+00:00 2026-06-04T22:53:09+00:00

I have a search text input in my layout page in a partialView and

  • 0

I have a search text input in my layout page in a partialView and other 3 pages that uses layout:

@using (Html.BeginForm("Search", "Product"))
{
    @Html.TextBoxFor(m => m.SearchText)
    @Html.ValidationMessageFor(m => m.SearchText)

    <input type="submit" value="Search"/>
}

When it goes inside Product/Search action, how can I know where it came from and return to the correct page with a message assuming the 3 other pages uses different ViewModels?

  • 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-06-04T22:53:10+00:00Added an answer on June 4, 2026 at 10:53 pm

    In your layout, modify your BeginForm to include the request path in the route values:

    @using (Html.BeginForm("Search", "Product"),new {path = Request.Path})
    

    Then, in your controller, you can finish up by redirecting to that path:

    public ActionResult Search( string path, FormCollection form ) {
        // build your search results here
        return Redirect( path );
    }
    

    And that should do the trick. If you need to pass additional information along, you can just append a query string to the path:

    public ActionResult Search( string path, FormCollection form ) {
        // build your search results here
        return Redirect( path + "?message=foo" );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have html input <input id=txtSearch value=Search... type=text/> Is it possible to animate the
I have a text input search that is supposed to filter divs based on
I have a search program that has multiple input text boxes that correspond to
I have next HTML: <input type=text id=search name=searchword value= /> <ul id=search_list> <li>first</li> <li>second</li>
I have a form in CakePHP that has two live-search text input. Each one
I have a JavaScript overlay that consists of several input text search criteria. When
In my website I have implemented search feature using full-text search. It works fine
I have a UI with a search text box and a button that that
I have a JLabel that needs to display some html-formatted text. However, I want
I have a search form tied to a backing bean that contains 4 input

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.