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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:21:28+00:00 2026-05-29T10:21:28+00:00

I have repeatedly run in to a problem when creating ASP.NET MVC 3 controllers

  • 0

I have repeatedly run in to a problem when creating ASP.NET MVC 3 controllers to which I haven’t found a good solution/design. Typically I want to create a search page, so I create my controller:

public class MyEntityController: Controller {
    public ActionResult Search() {
        return View();
    }
}

This lets me display the view where the user enters the search parameters. When submitting the search, I would normally have created an action to receive the search parameters and perform the actual search:

[HttpPost]
public ActionResult Search(SearchEditModel model) {
    IList<IMyEntity> results = ...; // Do the actual search.
    SearchResultsViewModel resModel = ...; // Convert it into a view model.

    // NOW WHAT?
}

The question is, what do I do now? I need to send my search results to a view to display them. But I can’t just call return View(resModel); since the Search view is already used to let the user input search parameters. This doesn’t seem like a very uncommon scenario so I’m guessing there is a “proper way” of 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-05-29T10:21:30+00:00Added an answer on May 29, 2026 at 10:21 am

    David,

    I don’t actually see a problem in approaching the problem in a similar way to how you have now. However, I’d use a viewmodel that included both your search IList as well as the advanced ‘parameters’ for the search (i.e. the SearchEditModel ). this way, you could return the search results in the lower portion of the view, with the search parameters still being visible in the upper portion. this would give the additonal benefit of allowing you to further refine your search if required. You would of course have to amend the signatures of both the httpget and httppost actions to accomodate this.

    your mileage may vary of course…

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

Sidebar

Related Questions

When creating scrollable user controls with .NET and WinForms I have repeatedly encountered situations
I have a python program/file that I want to run repeatedly and calculate the
I have been recently (and repeatedly) asked by customers about MIPS needed to run
I have a set of tasks that are done repeatedly and instead of creating
I'm using Stroustrup's swan book. I have run into a problem getting output from
We have a print engine which basically picks pre defined tasks to run against
I have an array of integers, which could run into the hundreds of thousands
I have been repeatedly asked the following questions in many interviews.... But still can't
for (;;) { //Something to be done repeatedly } I have seen this sort
We have an assembly that is called repeatedly by different executables and it shares

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.