i have two controller customer and order in mvc Application ..I wnat to show customer in drop down list in order controller when click on order create ..or click on following url .http://localhost:1957/order/Create
any help ..
i have two controller customer and order in mvc Application ..I wnat to show customer in drop down list in order controller when click on order create ..or click on following url .http://localhost:1957/order/Create
any help ..
You need to get a collection of customers in your model. You do this in your controller and pass the model to your view. For example:
var model = new MyModel();
model.Customers = GetCustomers();
return View(model)
Then in your view you have something like:
@Html.DropDownListFor(model => model.CustomerId, new SelectList(Model.Customers, "Id", "Name"), "")
Any chance of letting us know which language and which framework (if any) you're using?
can you share GetCustomers() function body ??
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.