我试图调用两个局部视图,但我的程序试图在我传递一个搜索参数之前填充我的网络网格。在将搜索框中的文本传递给它之前,我无法弄清楚如何阻止它尝试呈现 webgrid。这是我的部分观点:
<div class="webgrid-wrapper">
<div class="webgrid-title">Values</div>
<div id="grid">
@grid.GetHtml(
tableStyle: "webgrid",
headerStyle: "webgrid-header",
footerStyle: "webgrid-footer",
alternatingRowStyle: "webgrid-alternating-rows",
columns: grid.Columns(
grid.Column("Id", "ID"),
grid.Column("Name", "Name")
)
)
</div>
</div>
</div>
这是我的主页视图,我将两个部分视图都拉入:
<section class="featured">
<div class="content-wrapper">
<hgroup class="title">
<h1>@ViewBag.Title</h1>
<h2>@ViewBag.Message</h2>
</hgroup>
</div>
</section>
@using (Html.BeginForm("Analysis", "Home", "POST"))
{
<div class="searchField">
<div class="searchbox">
Search: <input type="text" name="Search" />
<input type="submit" value="Submit">
</div>
</div>
}
@Html.Partial("PartialChemAnalysis")
@Html.Partial("PartialSlagView")