Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Populating a combobox in MVC

Posted on 2015-02-22
2
Medium Priority
?
74 Views
Last Modified: 2015-03-03
Just starting with web development and trying to learn mvc.  I am using devexpress componets. I want to bind a combo box to a datasource.  My controller name is MaintenanceList.  I really have no idea how to even start.

Thanks
0
Comment
Question by:Moed
2 Comments
 
LVL 34

Accepted Solution

by:
Big Monty earned 2000 total points
ID: 40626772
taken from here

View
@{
 
if (@ViewContext.ViewData.ModelState.IsValid)

{

ViewBag.Title = "Index";

}

}
<h2>Abundant Code</h2>

@Html.DropDownList(“StateType”)

Controller


using MvcApplication1.Models;

using System;

using System.Collections.Generic;

using System.Linq;
 
using System.Web;

using System.Web.Mvc;

namespace MvcApplication1.Controllers

{

public class EmployeeController : Controller

{

public ActionResult Index()

{

ViewBag.ApplicationTitle = "AbundantCode App";

List<SelectListItem> obj = new List<SelectListItem>();

obj.Add(new SelectListItem { Text = "Solid State", Value = "1" });
obj.Add(new SelectListItem { Text = "Liquid State", Value = "2" });

Open in new window

0
 
LVL 2

Author Comment

by:Moed
ID: 40632242
I'll check it out.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developer tools in browsers have been around for a while, yet they are still heavily underused by developers. Developers still fix html or CSS then refresh page to see effect, or they put alert or debugger in JavaScript and then try again and again …
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question