Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Project
- {
- public Project()
- {
- CategoryId = 0;
- Name = "";
- Description = "";
- //Categories = new Dictionary<int, string>();
- Entities _db = new Entities(); //ef4
- CateogoriesList = from c in _db.Categories
- orderby c.Name
- select c.Name;
- }
- public int CategoryId { get; set; }
- [Required]
- [DataType(DataType.Text)]
- [Display(Name = "Project Name")]
- public string Name { get; set; }
- [Required]
- [DataType(DataType.MultilineText)]
- [Display(Name = "Project Description")]
- public string Description { get; set; }
- public IQueryable<string> CateogoriesList;
- }
- public ActionResult Create()
- {
- Models.Project.Project proj = new Models.Project.Project();
- return View(proj);
- }
- @{
- ViewBag.Title = "Create";
- Layout = "~/Views/Shared/_Layout.cshtml";
- }
- @model Models.Project.Project
- @using (Html.BeginForm())
- {
- @Html.ValidationSummary(true);
- <fieldset>
- <legend>Submit Your Request</legend>
- <div class="editor-label">@Html.LabelFor( Model => Model.CateogoriesList )</div>
- <div class="editor-field">
- @Html.DropDownList("Category", new SelectList( Model.CateogoriesList ) )
- </div>
- </fieldset>
- <p><input type="submit" value="Send for RFP" /></p>
- }
- Riebro.RiebroEntities _db = new Riebro.RiebroEntities();
- CategoriesList = (from c in _db.Categories
- orderby c.Name
- select c.Name).ToArray<string>();
- }
- [Display(Name = "Choose a category")]
- public string[] CategoriesList;
- @Html.DropDownList("Category", new SelectList(Model.CategoriesList))
- <div class="editor-label">@Html.LabelFor( Model => Model.CateogoriesList )</div>
- <div class="editor-label">@Html.LabelFor( Model => Model.CategoryId )</div>
- @using (Html.BeginForm())
- {
- @Html.ValidationSummary(true);
- <fieldset>
- <legend>Submit Your Request</legend>
- <div class="editor-label">@Html.LabelFor(x=>x.CategoryId )</div>
- <div class="editor-field">
- @Html.DropDownList("Category", new SelectList(Model.CateogoriesList) )
- </div>
- </fieldset>
- <p><input type="submit" value="Send for RFP" /></p>
- }
- public class Project {
- public Project() {
- CategoryId = 0;
- Name = "";
- Description = "";
- //Categories = new Dictionary<int, string>();
- //Entities _db = new Entities(); //ef4
- //CateogoriesList = from c in _db.Categories
- // orderby c.Name
- // select c.Name;
- //IQueryable<string> categoriesList = (new string[] { }).AsQueryable();
- CateogoriesList = new string[] { "abc", "def", "hij", "klm" };
- CategoriesList2 = (new string[] { "abc", "def", "hij", "klm" }).AsQueryable();
- }
- public int CategoryId { get; set; }
- [Required]
- [DataType(DataType.Text)]
- [Display(Name = "Project Name")]
- public string Name { get; set; }
- [Required]
- [DataType(DataType.MultilineText)]
- [Display(Name = "Project Description")]
- public string Description { get; set; }
- public string[] CateogoriesList;
- public IQueryable<string> CategoriesList2;
- }
- @model MvcApplication3.Models.Project
- @using (Html.BeginForm())
- {
- @Html.ValidationSummary(true);
- <fieldset>
- <legend>Submit Your Request</legend>
- <div class="editor-label">@Html.LabelFor(x=>x.CategoryId )</div>
- <div class="editor-field">
- @Html.DropDownList("Category", new SelectList(Model.CategoriesList2) )
- </div>
- </fieldset>
- <p><input type="submit" value="Send for RFP" /></p>
- }
- @model Models.Project.Project
- public ActionResult Create()
- {
- Riebro.Models.Project.Project proj = new Riebro.Models.Project.Project();
- return View(proj);
- }
- @Html.LabelFor(Model => Model.CateogoriesList)
- <div class="editor-label">@Html.LabelFor( Model => Model.CateogoriesList )</div>
- <div class="editor-label">@Html.LabelFor( m=> m.CateogoriesList )</div>
Add Comment
Please, Sign In to add comment