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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:59:52+00:00 2026-05-21T04:59:52+00:00

I have a simple Wall.cshtml view that loads a _Search.cshtml Partial View that looks

  • 0

I have a simple Wall.cshtml view that loads a _Search.cshtml Partial View that looks like this:

<h2>The Wall</h2>
@{Html.RenderPartial("~/Views/Search/_Search.cshtml");}

The _Search.cshtml Partial View (updated based on @Darin reply) looks like this:

@using (Html.BeginForm("Searching", "Search", FormMethod.Post, new { id = "searchForm" }))    
{  
    <div id="search">
        <div id="searchbtn">
           <input id="Search" type="button" value="Search" />
        </div>
        <div id="searchtxt">
           @Html.TextBox("txtSearch")
        </div>
  </div>
}

The Controller looks like this:

public class SearchController : Controller
{
    public ActionResult Wall()
    {
        return View();
    }

    [HttpPost]
    public ActionResult Searching()
    {
        // do something with the search value
        return View();
    }
}

When I run the app, the resulting block of HTML produced looks like this:

<form action="/Search/Searching" id="searchForm" method="post">  
   <div id="search">
      <div id="searchbtn">
          <input id="Search" type="button" value="Search" />
      </div>
      <div id="searchtxt">
          <input id="txtSearch" name="txtSearch" type="text" value="" />
      </div>
   </div>
</form>

QUESTION 1: Why would the button click never hit the Searching Controller method?
(let me restate that _Search.cshtml is a Partial view that runs inside a view named Wall.cshtml).

QUESTION 2: How would I get the value inside the “txtSearch” textbox?

QUESTION 3: Since this is a Partial View, how do I make the view that holds the current Search Partial View ..to refresh and update itself with the result of the Search query?

  • 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-21T04:59:53+00:00Added an answer on May 21, 2026 at 4:59 am

    It would be better to use a form and making the search button submit:

    @using (Html.BeginForm("Search", "Home", FormMethod.Post, new { id = "searchForm" }))    
    {
        <div id="search">
            <div id="searchbtn">
                <input id="Search" type="submit" value="Search" />
            </div>
            <div id="searchtxt">
                @Html.TextBox("txtSearch")
            </div>
        </div>
    }
    

    As far as your second question is concerned, you could AJAXify this search form:

    $(function() {
        $('#searchForm').submit(function() {
            $.ajax({
                url: this.action,
                type: this.method,
                success: function(result) {
                    $('#resultContainer').html(result);
                }
            });
            return false;
        });
    });
    

    where resultContainer could be some div that will harbor the search results returned from the controller action.

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

Sidebar

Related Questions

This seems like it should be simple but it's driving me up the wall.
I have simple html page and need to post data (title/text) from that page
I have something like Facebook's Wall build on PHP that uses MySQL database. Structure:
So I have beating my head against the wall on this. I feel like
This is a very simple form that I have found on the web (as
Hitting my head against a wall here. Feel like this should be simple, but
I have simple php validation form that is halfway working. If you leave the
I have simple win service, that executes few tasks periodically. How should I pass
I have got a ball which bounces of walls. This bounce is simple, i
This seems like a fairly simple issue, however I could not find any straight

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.