I have the following code to search through a table and return the matching results. The search works as expected, and the reset button works before the Search button is pressed, but it doesn't do anything after it is pressed. The expected/desired result is to go back to the initial view before the search is completed.
@Using Html.BeginForm()
@<p>
Search: @Html.TextBox("SearchString")
<input type="submit" value="Search" />
<input type="reset" value="Reset" />
</p>
End Using
What do I need to add or do differently to achieve this result?
CodePudding user response:
I was able to figure it out - a little differently than I thought I wanted but it does exactly what I needed. Instead of a button, I used an HTML.ActionLink
.
@Using Html.BeginForm()
@<p>
Search: @Html.TextBox("SearchString")
<input type="submit" value="Search" />
@Html.ActionLink("Reset", "Index", New With {.sortOrder = ViewBag.LastNameSortParm, .searchString = ViewBag.value, .deptString = ViewBag.DeptFilter})
</p>
End Using