Reputation: 13
Ok, This is a bit confusing and frustrating. Here's what I have in my masterpage :
<%using (Html.BeginForm("Index", "SearchController", FormMethod.Post, new { @name = "dosearch" }))
{%>
<input type="text" name="ssearch" class="search"><a href="#" onclick="document.dosearch.submit();"><input id="Image1" type="image" runat="server" src="~/App_Themes/DefaultTheme/images/btn_search.gif" width="74" height="29" style="border:none" /></a>
<%} %>
But the corresponding generated html is:
<form action="" method="post" name="dosearch">
<input type="text" name="ticketSearch" class="search"><a href="#" onclick="document.dosearch.submit();"><input src="../App_Themes/DefaultTheme/images/btn_search.gif" name="ctl00$Image1" type="image" id="ctl00_Image1" width="74" height="29" style="border:none" /></a>
</form>
Question is WHY action is empty whereas I have mention action and controllername when declaring the HTML.Helper ???? as a reasult, the seach is not working for obvious reason.
Please help. Thanks.
Upvotes: 0
Views: 282
Reputation: 26690
I think your problem is that you are using "SearchController" but you only need to use "Search" as the MVC framework will add the word "controller".
Also, not that it matters but you are missing a closing input tag
Upvotes: 3