Fiddlerを使用すると、リクエストが行われていないことはわかりますが、理由はわかりません。
フォームは次のとおりです。
@using (Html.BeginForm("Index", "FileSystemChannelIndex", FormMethod.Post, new {
channelId = @Model.ChannelId }))
{
@Html.HiddenFor(model => model.Id)
@Html.HiddenFor(model => model.ChannelId)
<div class="editor-label">
Select File Source
</div>
<div class="editor-field">
@Html.DropDownListFor(
model => model.SelectedFileSourceValue,
new SelectList(Model.AvailableFilesSources, "Id", "Name"),
new { id = "selectFileSource" })
</div>
<p>
<input class="t-button" type="submit" value="Save" />
</p>
}
ビューは元々次のものから来ました:
public ViewResult Create(int channelId)
{
var channel = this.fullUOW.GetFileSystemChannelRepository().All.Where(c => c.Id == channelId);
var vm = new FileSystemChannelIndexViewModel(channelId, new FileSystemChannelIndex());
return View("Edit", vm);
}
「name」属性をに追加しようとしましたが、違いはありませんでした。
何か案は?
編集:ジムらの詳細...
ドメイン:
public class FileSystemChannel
{
public int Id {get; set; }
public ICollection<FileSystemChannelIndex> ChannelIndexes { get; set; }
}
public class FileSystemChannelIndex
{
public int Id { get; set; }
public FileSystemChannel ParentChannel { get; set; }
}
0 ... *の関連付けのため、UIで最初にFileSystemChannelを作成してから、FileSystemChannelIndexを追加する必要があります。そのため、channelIdをFileSystemChannelIndex作成ビューに渡します。新しいFileSystemChannelIndexを送信するときは、次のアクションを呼び出す必要があります。
[HttpPost]
public ActionResult Index(int channelId, FileSystemChannelIndexViewModel vm)
{
//TODO: get the Channel, add the Index, save to db
return View("Index");
}