Save is not working

Jan 12, 2011 at 5:04 PM
Edited Jan 13, 2011 at 3:49 PM

When trying to save, page 84, it is not sending anything to the server. It is not entering in this method:

public ActionResult Edit(int id, FormCollection collection)

 

The save is here:

 

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Edit Album </h2>

    <% using (Html.BeginForm()) {%>
        <%: Html.ValidationSummary(true) %>
        
        <fieldset>
            <legend>Edit Album</legend>
            <%: Html.EditorFor(model => model.Album,
                new {Artists = Model.Artists, Genres = Model.Genres})%>
            
            <p>
                <input type="submit" value="Save" />
            </p>
        </fieldset>

    <% } %>

    <div>
        <%: Html.ActionLink("Back to List", "Index") %>
    </div>

</asp:Content>

This is my Album.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcMusicStoreEmpty.Models.Album>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Edit 
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <% using (Html.BeginForm()) {%>
        <%: Html.ValidationSummary(true) %>

            <p>
                <%: Html.LabelFor(model => model.Genre) %> </br>
                <%: Html.DropDownList ("GenreId", new SelectList(ViewData["Genres"] as IEnumerable,
                    "GenreId","Name", Model.GenreId)) %>
            </p>

            <p>    
                <%: Html.LabelFor(model => model.Artist) %></br>
                <%: Html.DropDownList ("ArtistId", new SelectList(ViewData["Artists"] as IEnumerable,
                    "ArtistId","Name", Model.ArtistId)) %>
            </p>

            <p>                
                <%: Html.LabelFor(model => model.Title) %> </br>
                <%: Html.TextBoxFor(model => model.Title) %>
                <%: Html.ValidationMessageFor(model => model.Title) %>
            </p>

            <p>
                <%: Html.LabelFor(model => model.Price) %> </br>
                <%: Html.TextBoxFor(model => model.Price, String.Format("{0:F}", Model.Price)) %>
                <%: Html.ValidationMessageFor(model => model.Price) %>
            </p>
            
            <p>
                <%: Html.LabelFor(model => model.AlbumArtUrl) %></br>
                <%: Html.TextBoxFor(model => model.AlbumArtUrl) %>
                <%: Html.ValidationMessageFor(model => model.AlbumArtUrl) %>
            </p>

    <% } %>



</asp:Content>

Jan 13, 2011 at 3:51 PM
Edited Jan 13, 2011 at 3:56 PM

Now the Save is working. The problem was that was keeping the following code in the Album.aspx:

    <% using (Html.BeginForm()) {%>
        <%: Html.ValidationSummary(true) %>

Hope it helps somebody else with the same problem.