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

  • Home
  • SEARCH
  • 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 7934099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:32:22+00:00 2026-06-03T21:32:22+00:00

I am building a WebMatrix-based site, and I overlooked something. Something that just didn’t

  • 0

I am building a WebMatrix-based site, and I overlooked something. Something that just didn’t occur to me.

My site is made up so that each page refers to the _SiteLayout.cshtml page for the header and footer. For example:

_SiteLayout.cshtml:

<html>
<head>
</head>
<body>
     <div id="Container">
          <div id="heading">
               <input type="text" name="search" value="search" id="searchbox" />
          </div>
          @RenderBody() <!-- display Default.cshtml content -->
         <div id="footer"><p>stuff here</p></div>
     </div>
</body>
</html>

Default.cshtml:

@{
     Layout = "~/_SiteLayout.cshtml";
}
<p>
 I want to display search results in the Default.cshtml (homepage) page, but I don't know how to if the search form is inside the SiteLayout page. How to do this?
</p>

So, my question is I want to display search results in the Default.cshtml (homepage) page, but I don’t know how to if the search form is inside the SiteLayout page.

How do I go about doing this?

  • 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-03T21:32:24+00:00Added an answer on June 3, 2026 at 9:32 pm

    You’ll need to post the information in that search input to the server. Once you have the data back, you can use it to target an HTML element you know will be in the subviews.

    This article from the jQuery docs helped me out. My data was coming from a JSON response, but the example shows how you can use jQuery to take the results response and add it to a specific element (in this case, the <body>, but you could just as easily create a div with an id of “search-results” and target it with #search-results):

    $.getJSON('ajax/test.json', function(data) {
      var items = [];
    
      $.each(data, function(key, val) {
        items.push('<li id="' + key + '">' + val + '</li>');
      });
    
      $('<ul/>', {
        'class': 'my-new-list',
        html: items.join('')
      }).appendTo('body');  // Here, you could append your items to #search-results
    });
    

    Then it would be up to all the views to contain a section with an ID of search-results, but if it didn’t exist, then the data just wouldn’t show up anywhere. The script should be in a separate file and referenced in your main site layout.

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

Sidebar

Related Questions

Building a mobile site and wanted to create a rotator that would work just
building a site using PHP and MySQL that needs to store a lot of
building a site which has content for each section. urls range from; /work/ /work/print/
Building an app with the Facebook JavaScript API that will embedded into a page
Building a website that has English & Japanese speaking users, with the Japanese users
Building an iPhone OS application that will allow users to anonymously post information to
Building a commercial product may use various open source libraries that have use of
Building a site super quick and having it work on all my Mac browsers,
Building a website using a PHP based Ecommerce product Magento. The problem I have
Building my first WP theme and I quickly realized that I need to remove

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.