overloading Html.Form()

Last post 10-10-2008 3:23 PM by shredguitar. 0 replies.

Sort Posts:

  • overloading Html.Form()

    10-10-2008, 3:23 PM
    • Member
      4 point Member
    • shredguitar
    • Member since 09-29-2008, 2:49 PM
    • Posts 8
    Hi,

     

    I'm having quite a bunch of problems trying to use the overloaded version of the Html.Form() helper.

    I have a ProductController class, and a method AddProduct(int id) in it. When I access this method via a Html.ActionLink everything works fine, but when I try to use the form nothing happens - the method is not called. Here is the source code for my form, and immediately below that, the link which points to the same place, and it works fine.

     

    1            <% using (Html.Form("Product", "AddProduct", FormMethod.Get))
    2 { %>
    3 <%=Html.Hidden("id", ViewData["categoryID"].ToString(), null) %>
    4 <%=Html.SubmitButton("button", ViewData["headerString"].ToString())%>
    5 <%} %>
    6 <%=Html.ActionLink( ViewData["headerString"].ToString(), "AddProduct", new { id = ViewData["categoryID"].ToString() } )%>
     
    This is what the interface for the AddProduct() method looks like:

     

    1            [AcceptVerbs("GET"), ActionName("AddProduct")]
    2 public ActionResult AddProduct(int id)
Page 1 of 1 (1 items)