Asp.net mvc 4 表行内的手风琴
我正在使用Twitter引导。目前,我正在处理主详细信息表,我计划在每个表的行中放置一个手风琴,如果展开,将重新加载并显示局部视图 不知何故,它并没有像预期的那样工作,但如果我将其更改为模态,则部分视图将完全加载 这是处理和返回值的控制器:Asp.net mvc 4 表行内的手风琴,asp.net-mvc-4,twitter-bootstrap,Asp.net Mvc 4,Twitter Bootstrap,我正在使用Twitter引导。目前,我正在处理主详细信息表,我计划在每个表的行中放置一个手风琴,如果展开,将重新加载并显示局部视图 不知何故,它并没有像预期的那样工作,但如果我将其更改为模态,则部分视图将完全加载 这是处理和返回值的控制器: public ActionResult Index(int id,int? page) { List<CustomerProduct> customerProducts = (from c in Repo
public ActionResult Index(int id,int? page)
{
List<CustomerProduct> customerProducts =
(from c in RepositoryProduct.Reload(id)
select c).ToList<CustomerProduct>();
return PartialView("_CustomerProducts", customerProducts);
}
public ActionResult索引(int-id,int-page)
{
列出客户产品=
(从RepositoryProduct.Reload(id)中的c)
选择c.ToList();
返回PartialView(“_CustomerProducts”,CustomerProducts);
}
这是视图中的表:
<table id="tbl" class="table table-condensed" style="border-collapse:collapse;">
<thead>
<tr>
<th>
@Html.ActionLink("Customer Name", "Index", new { sortOrder = ViewBag.NameSortParm, currentFilter = ViewBag.CurrentFilter })
</th>
<th>
@Html.DisplayNameFor(model => model.First().CustLocalName)
</th>
<th>
@Html.ActionLink("Country", "Index", new { sortOrder = ViewBag.CountrySortParm, currentFilter = ViewBag.CurrentFilter })
</th>
<th>
@Html.DisplayNameFor(model => model.First().City)
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr data-toggle="collapse">
<td style="display:none;">
@Html.DisplayFor(modelItem => item.CustID)
</td>
<td>
@Html.DisplayFor(modelItem => item.CustName)
</td>
<td>
@Html.DisplayFor(modelItem => item.CustLocalName)
</td>
<td>
@Html.DisplayFor(modelItem => item.Country.CountryName)
</td>
<td>
@Html.DisplayFor(modelItem => item.City)
</td>
<td>
<a class="btn btn-small btn-info" type="button" href="@Url.Action("Index", "CustomerProduct", new { id = item.CustID })" data-toggle="collapse" data-target="#@item.CustID" >Products</a>
</td>
</tr>
<tr>
<td colspan="6" class="hiddenRow">
<div id="@item.CustID" class="accordian-body collapse" tabindex="-1">
<div class="accordion-header">
<label>
<strong>@item.CustName product(s)</strong>
</label>
</div>
<div class="accordion-body">TEST</div>
</div>
</td>
</tr>
}
</tbody>
</table>
@ActionLink(“客户名称”、“索引”,新的{sortOrder=ViewBag.NameSortParm,currentFilter=ViewBag.currentFilter})
@DisplayNameFor(model=>model.First().CustLocalName)
@ActionLink(“国家”,“索引”,新{sortOrder=ViewBag.CountrySortParm,currentFilter=ViewBag.currentFilter})
@DisplayNameFor(model=>model.First().City)
@foreach(模型中的var项目)
{
@DisplayFor(modelItem=>item.CustID)
@DisplayFor(modeleItem=>item.CustName)
@DisplayFor(modelItem=>item.CustLocalName)
@DisplayFor(modelItem=>item.Country.CountryName)
@DisplayFor(modeleItem=>item.City)
@item.CustName产品
试验
}
这是调用控制器索引函数的部分代码:
<a class="btn btn-small btn-info" type="button" href="@Url.Action("Index", "CustomerProduct", new { id = item.CustID })" data-toggle="collapse" data-target="#@item.CustID" >Products</a>
实际上,我想在div class=“accordion body”中加载partialview(\u CustomerProduct),就像我在div class=“modal body”中所做的那样,但没有成功。我可以知道是否可以这样做吗?如果可以,我可以知道如何做吗
如果有任何帮助,我们将不胜感激。请允许我使用视图
<td colspan="6" class="hiddenRow">
<div id="@item.CustID" class="accordian-body collapse" tabindex="-1">
<div class="accordion-header">
<label>
<strong>@item.CustName product(s)</strong>
</label>
</div>
<div class="accordion-body">
@Html.Partial("_CustomerProduct")
</div>
</div>
</td>
@item.CustName产品
@Html.Partial(“_CustomerProduct”)