I have a form that I want to populate two form fields with data. The user clicks on an button on a details view and is sent to a Form. I pass the id as a session.
Here is my controller:
public ActionResult CreateOrder()
int id = Convert.ToInt32(HttpContext.Session["Id"]);
var Name = "";
var Desc = "";
var data = DB.vw_Order
.Where(x => x.ID == id
Name = data.Name;
Description = data.Description;
newOrder newOrd = new newOrder()
OrderDate = DateTime.Now,
Nomenclature = nomen,
Name = name,
Here is a snippet of my form:
@Html.TextBox("Name", Model.Name, new
@disabled = true,
@class = "form-control"
The above works. Now I need to populate two other fields but the returned data could be more than one record.
Can I add a list to my controller and pass that to the View and then use For Loop?