我有一个partial_view,我在那里传递了一个架构详细信息的数据表。 我也想要下面的显示视图 Schema_Details表:
SType : Equity
S_Name|Allocation|Lum_Sum_Value|SIP
Xyz |30% |250000 |2000
在控制器中,我获得数据分组依据 我的控制器:
[HttpPost]
public Action Result recommended-portfolio(int sName)
{
using (var db = new WFTradeEntities())
{
var tr = db.Schema_Details.ToList().Where(x => x.RID == sName).Select(x => new Schema_Details
{
SID = x.SID, RID = x.RID,Schema_Name = x.Schema_Name,SType = x.SType,
InvestmentType = x.InvestmentType, Allocation = x.Allocation,
Lum_Sum_Amount = x.Lum_Sum_Amount,
cal = Convert.ToDouble(x.Allocatio/100.0 * 25000),
SIP=Convert.ToDouble(x.Allocation / 100.0 * 5000)}).GroupBy(x => x.SType);
return PartialView("_PortfolioTable", tr);
}
}
我的视图不显示网格:
我的观看数据: @model IEnumerable
@foreach (var group in Model.GroupBy(item => item.SType))
{
@Html.Encode(group.Key)
@foreach (var item in group) {
@Html.Encode(item.Schema_Name)
}