我正在第一页和第二页上查看列表,它应该使用第一页上的数据库中相同的ID进行链接,但在第二页上则使用其详细信息页。
第一页-列表视图
第二页-详细信息
这是我已经尝试过的
示例:http://abctutorial.com/Post/53/mvc5-master-detail-edit-using-aspnet--jquery--razor
public Ordering()
{
this.Invoice_Line_Item = new HashSet<Invoice_Line_Items>();
}
[Key]
public int order_id { get; set; }
public Guid? CustomerId { get; set; }
public int? CustId { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
[StringLength(34)]
public string invoice_number { get; set; }
[StringLength(200)]
public string EmailId { get; set; }
[StringLength(50)]
public string ClientFirstname { get; set; }
[StringLength(50)]
public string ClientLastname { get; set; }
[StringLength(50)]
public string MobileNumber { get; set; }
[StringLength(50)]
public string PaymentStatus { get; set; }
[StringLength(50)]
public string trackingorderno { get; set; }
[StringLength(50)]
public string Status { get; set; }
[StringLength(200)]
public string DeliveryNote { get; set; }
[StringLength(250)]
public string Agent { get; set; }
public DateTime? date_order_placed { get; set; }
public virtual ICollection<Invoice_Line_Items> Invoice_Line_Item {
get; set; }
@model IEnumerable<LifestyleAdminOriginal.Models.Ordering>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.invoice_number)
</td>
<td>
@Html.DisplayFor(modelItem => item.ClientFirstname) @Html.DisplayFor(modelItem => item.ClientLastname)
</td>
<td>
@Html.DisplayFor(modelItem => item.EmailId)
</td>
<td>
@Html.DisplayFor(modelItem => item.MobileNumber)
</td>
<td>
<span class="label label-danger">@Html.DisplayFor(modelItem => item.Status)</span>
</td>
<td>
@Html.ActionLink("View", "NewOrdersDetails", new { id = item.CustId })
</td>
</tr>
}
<div class="row">
@if (Model.Count() != 0)
{
foreach (var item in Model)
{
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="invoice-sp">
<table class="table table-hover">
<thead>
<tr>
<th>Service</th>
<th>Item</th>
<th>Gender</th>
<th>Unit Price</th>
<th>Quantity</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<tr>
@foreach (var inv in item.Invoice_Line_Item)
{
<th>@inv.service</th>
<td>@inv.item</td>
<td>@inv.gender</td>
<td>@inv.price</td>
<td>@inv.quantity</td>
<td>@inv.price</td>
}
</tr>
</tbody>
</table>
</div>
</div>
}
}
</div>
public ActionResult NewOrders()
{
var count = db.Orderings.Where(s => s.trackingorderno == "New Order").Count();
ViewBag.totalall = count;
return View(db.Orderings.ToList().Where(x => x.trackingorderno == "New Order").Select(x => x));
}
public ActionResult NewOrdersDetails(int? CustId)
{
if (CustId == null)
{
return new System.Web.Mvc.HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
List<Ordering> OrderAndCustomerList = db.Orderings.ToList();
if (OrderAndCustomerList == null)
{
return HttpNotFound();
}
return View(OrderAndCustomerList);
}
[基本上,每当用户在列表视图页面上单击“查看”时,都应将其带到详细信息页面,在该页面上显示发票行项目并在“ DetailsView”的页面上显示客户详细信息
我正在第一页和第二页上查看列表,它应该使用第一页上的数据库中相同的ID进行链接,但在第二页上则使用其详细信息页进行链接。第一页-列表视图第二页-详细信息...
在显示主数据的第一张表和第一张表数据的第二张表详细信息中因此您必须在主表内容中获取明细表内容ID,然后将其与主表中的明细ID一起发送到第二页。