【发布时间】:2016-12-11 11:01:52
【问题描述】:
我在谷歌上搜索了很多关于这个问题的信息,但找不到关于我的场景的任何帮助。所以,这是一个问题
我有一个包含单个下拉列表的表单,名为 Sections,用户可以选择一个 Section,然后用户有 两个 选择。
1-通过转到文件上传表单将文件添加到此部分
2-通过转到添加部分表单添加更多子部分
This is image of my form
@using (Html.BeginForm("SectionForm","Sections"))
{
<div class="form-group">
@Html.DisplayFor(s => s.SectionName)
@Html.DropDownListFor(s => s.SelectedSection, new SelectList(Model.Sections,"SectionId","SectionName"),"Select a Section",new {@class = "form-control",autofocus="autofocus"} )
</div>
<p>
If you don't see your desired section here, Click <strong>Add Section</strong>.
</p>
<button type="submit" class="btn btn-primary">Add Further Subsection</button>
<br />
<a href="@Url.Action("FileForm","LawFiles",new { sectionId = Model.SelectedSection })" class="btn btn-primary">Add File</a>
}
<br>
SectionForm 和 FileForm 是我的操作,Sections 和 LawFiles 是控制器。
在我不提交表单之前,最后的锚标记将不起作用
【问题讨论】:
-
感谢编辑@Yogi
-
从 form 范围中移除 anchor tag。在表格右括号之后添加它..
-
是的,在实际代码中它超出了表单范围。
-
然后在这里发布实际代码..
-
这是实际的代码先生。我无法理解 stackoverflow 如何发布代码。所以这是一个小错误。
标签: c# asp.net asp.net-mvc forms