Generating form results when user first vists page

timer Asked: Jan 30th, 2014

Question description


I am creating a web application. On a particular page I have a search area, where the user can input details into a search form and click "Search" to submit. Then to the right of that search box, a list of search results will appear.

At the moment when the user visits the page all they can see is "no search result" because that haven't entered any details to search by. How do I automatically display a list of all the search results potentially available when the user sees the page for the first time? At this stage the user has not completed the form - but how do I show all possible results anyway?

This is a brief overview of the kind of thing I am looking at.

//Getting input details:

<div class="panel-body">

@using (Html.BeginForm/................./ }))


@(this.Html.Partial("Search", new SearchViewModel { SearchCriteria = this.Model.SearchCriteria}))

<button type="submit" class="btn btn-primary">Search</button>



//Posting results


@if (Model != null && Model.SearchResult != null)



@if (Model.SearchResult.Any())


foreach (var demand in Model.SearchResult)





<p class="text-info">@(IsPost ? "No match was found." : "No search result.")</p>


Tutor Answer

(Top Tutor) Studypool Tutor
School: New York University
Studypool has helped 1,244,100 students
flag Report DMCA
Similar Questions
Hot Questions
Related Tags

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors