Need to display different views on same button click in Sitecore MVC

I have created a placeholder(placeholder1) for search textbox and button. 

On click on button I need to show the search results in the below holder (Placeholder2). Placeholder1 and placeholder2 are on the same page.

I have created a controller rending for search functionality. Below are the two index action method one is for get and the other is for post.

public ActionResult Index()
return View("SearchForm");


public ActionResult Index()
return View("SearchResults");

On initial page load I can see SearchForm view is getting displayed in placeholder1.

When I click on search button for post, The SearchForm view is getting disappeared and the SearchResults view is getting displayed on placeholder1.

Can you please let me know how can I achieve the correct functionality. I want both SearchForm view and SearchResults view to appear after clicking on the search button on different placeholders.

  • Hi Nawaz,

    Since the name of the method is same, it is getting confused and displaying in the same placeholder.

    I will recommend below structure, see if you would like to implement.

    Create 2 place holders on one page:

    Create one View Rendering with Textbox & Button and place it in SearchBox placeholder.

    Create one Controller Rendering for SearchResult with one normal method & one Http Post method. Pass empty list of values for normal method

    On click of the button in View Rendering, write a Ajax to call the method which is decorated with Http Post and which will pass the results to the controller rendering.

    And in this case your Search Box will also be maintained.

    Hope this helps and let me know if you have any queries.