Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET MVC 3 (Razor) form submit not working
    primarykey
    data
    text
    <p>Using Fiddler I can see that the request is not even being made but I can't see why.</p> <p>Here's the form:</p> <pre><code>@using (Html.BeginForm("Index", "FileSystemChannelIndex", FormMethod.Post, new { channelId = @Model.ChannelId })) { @Html.HiddenFor(model =&gt; model.Id) @Html.HiddenFor(model =&gt; model.ChannelId) &lt;div class="editor-label"&gt; Select File Source &lt;/div&gt; &lt;div class="editor-field"&gt; @Html.DropDownListFor( model =&gt; model.SelectedFileSourceValue, new SelectList(Model.AvailableFilesSources, "Id", "Name"), new { id = "selectFileSource" }) &lt;/div&gt; &lt;p&gt; &lt;input class="t-button" type="submit" value="Save" /&gt; &lt;/p&gt; } </code></pre> <p>The View originally came from:</p> <pre><code>public ViewResult Create(int channelId) { var channel = this.fullUOW.GetFileSystemChannelRepository().All.Where(c =&gt; c.Id == channelId); var vm = new FileSystemChannelIndexViewModel(channelId, new FileSystemChannelIndex()); return View("Edit", vm); } </code></pre> <p>I've tried adding the "name" attribute to the but that didn't make any difference.</p> <p>Any ideas?</p> <p><strong>EDIT:</strong> More info for Jim et al...</p> <p>Domain:</p> <pre><code>public class FileSystemChannel { public int Id {get; set; } public ICollection&lt;FileSystemChannelIndex&gt; ChannelIndexes { get; set; } } public class FileSystemChannelIndex { public int Id { get; set; } public FileSystemChannel ParentChannel { get; set; } } </code></pre> <p>Due to a 0...* association, in the UI we have to create a FileSystemChannel first then add a FileSystemChannelIndex to it. So that's why I pass in the channelId to the FileSystemChannelIndex Create View. When submitting the new FileSystemChannelIndex the following action should be called:</p> <pre><code>[HttpPost] public ActionResult Index(int channelId, FileSystemChannelIndexViewModel vm) { //TODO: get the Channel, add the Index, save to db return View("Index"); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload