Asp.net mvc 如何在Combobox中将会话设置为ReceiveInvoice以保存下一个条目的接收ID
我想为下一个使用会话的条目使用接收发票,但它没有。在这里,我在create controller中填充Receive InvoiceNo。请帮帮我Asp.net mvc 如何在Combobox中将会话设置为ReceiveInvoice以保存下一个条目的接收ID,asp.net-mvc,session,Asp.net Mvc,Session,我想为下一个使用会话的条目使用接收发票,但它没有。在这里,我在create controller中填充Receive InvoiceNo。请帮帮我 var rmaster = db.FactoryReceiveMaster.ToList(); List<SelectListItem> lstFactoryReceiveMaster = new List<SelectListItem>(); if (rmaster != null &am
var rmaster = db.FactoryReceiveMaster.ToList();
List<SelectListItem> lstFactoryReceiveMaster = new List<SelectListItem>();
if (rmaster != null && rmaster.Count > 0)
{
foreach (var rInvoice in rmaster)
{
SelectListItem item = new SelectListItem { Text = rInvoice.RInvoiceNo, Value = rInvoice.Receive_ID.ToString(), Selected = false };
lstFactoryReceiveMaster.Add(item);
}
}
Session["lstFactoryReceiveMaster"] = lstFactoryReceiveMaster;
model.AssembleInvoice = lstFactoryReceiveMaster;
var rmaster=db.FactoryReceiveMaster.ToList();
List lstFactoryReceiveMaster=新列表();
如果(rmaster!=null&&rmaster.Count>0)
{
foreach(rmaster中的语音)
{
SelectListItem=new SelectListItem{Text=rInvoice.RInvoiceNo,Value=rInvoice.Receive_ID.ToString(),Selected=false};
lstFactoryReceiveMaster.Add(项目);
}
}
会话[“lstFactoryReceiveMaster”]=lstFactoryReceiveMaster;
model.AssembleInvoice=lstFactoryReceiveMaster;
创建视图
@using Kendo.Mvc.UI;
@model MvcMahindraTwoWheelerERP.Models.FactoryProductAssembledViewModel
<div class="panel panel-info">
<div class="panel-heading">
<h3 style="font-family:cursive;font-size:large;"> Assemble Product - Entry Form</h3>
</div>
<div class="panel-body">
@using (Html.BeginForm("Create", "FactoryAssembleProduct", FormMethod.Post))
{
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-horizontal">
<div class="form-group">
<div class="form-group">
<div class="col-sm-offset-1 col-sm-4">
@Html.LabelFor(model => model.Assembled_Date)
@(Html.Kendo().DatePickerFor(model => model.Assembled_Date).Format("dd/MMM/yyyy").HtmlAttributes(new { @style = "width:100%;"}))
@Html.ValidationMessageFor(model => model.Assembled_Date)
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-4">
@Html.LabelFor(model => model.FactoryReceiveMaster.RInvoiceNo)
@(Html.Kendo().ComboBoxFor(model => model.FactoryReceiveMaster.Receive_ID).BindTo(Model.AssembleInvoice).HtmlAttributes(new {@style = "width:100%;"}))
@Html.ValidationMessageFor(model => model.FactoryReceiveMaster.Receive_ID)
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-4">
@Html.LabelFor(model => model.Product.ProdCode)
@(Html.Kendo().ComboBoxFor(model => model.Product.ProductID).BindTo(Model.AssembleProducts).HtmlAttributes(new {id="ProductID", @style = "width:100%;"}).Filter(FilterType.Contains))
@Html.ValidationMessageFor(model => model.Product.ProductID)
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-4">
@Html.LabelFor(model => model.Description)
@Html.TextBoxFor(model => model.Description, new { id="descriptipn", @class = "form-control" })
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-4">
@Html.LabelFor(model => model.Chassis_No)
@Html.TextBoxFor(model => model.Chassis_No, new {@class = "form-control" })
@Html.ValidationMessageFor(model => model.Chassis_No)
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-4">
@Html.LabelFor(model => model.Engine_No)
@Html.TextBoxFor(model => model.Engine_No, new {@class = "form-control" })
@Html.ValidationMessageFor(model => model.Engine_No)
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-4">
@Html.LabelFor(model => model.Key_No)
@Html.TextBoxFor(model => model.Key_No, new {@class = "form-control" })
@Html.ValidationMessageFor(model => model.Key_No)
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-4">
@Html.LabelFor(model => model.Remarks)
@Html.TextBoxFor(model => model.Remarks, new {@class = "form-control" })
@Html.ValidationMessageFor(model =>model.Remarks)
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-4">
<input type="submit" class="btn btn-lg btn-primary btn-block" value="Save Changes" />
</div>
</div>
</div>
</div>
}
</div>
@使用Kendo.Mvc.UI;
@模型MVCMahindratwowheelerep.Models.FactoryProductAssembledViewModel
装配产品-输入表格
@使用(Html.BeginForm(“创建”、“FactoryAssembleProduct”、FormMethod.Post))
{
@Html.ValidationSummary(true,“,new{@class=“text danger”})
@LabelFor(model=>model.Assembled\u日期)
@(Html.Kendo().DatePickerFor(model=>model.Assembled_Date).Format(“dd/MMM/yyyy”).HtmlAttributes(新的{@style=“width:100%;”}))
@Html.ValidationMessageFor(model=>model.Assembled\u日期)
@LabelFor(model=>model.FactoryReceiveMaster.RInvoiceNo)
@(Html.Kendo().ComboBoxFor(model=>model.FactoryReceiveMaster.Receive_ID).BindTo(model.AssembleInvoice).HtmlAttributes(新的{@style=“width:100%;”}))
@Html.ValidationMessageFor(model=>model.FactoryReceiveMaster.Receive\u ID)
@LabelFor(model=>model.Product.ProdCode)
@(Html.Kendo()
@Html.ValidationMessageFor(model=>model.Product.ProductID)
@LabelFor(model=>model.Description)
@Html.TextBoxFor(model=>model.Description,新的{id=“descriptipn”,@class=“form control”})
@Html.LabelFor(model=>model.Chassis\u No)
@Html.TextBoxFor(model=>model.Chassis_No,new{@class=“form control”})
@Html.ValidationMessageFor(model=>model.Chassis\u No)
@LabelFor(model=>model.Engine\u No)
@Html.TextBoxFor(model=>model.Engine_No,new{@class=“form control”})
@Html.ValidationMessageFor(model=>model.Engine\u No)
@LabelFor(model=>model.Key\u No)
@Html.TextBoxFor(model=>model.Key_No,new{@class=“form control”})
@Html.ValidationMessageFor(model=>model.Key\u No)
@LabelFor(model=>model.comments)
@Html.TextBoxFor(model=>model.comments,新的{@class=“form control”})
@Html.ValidationMessageFor(model=>model.备注)
}
现在,现在如何修复它