selectlist Questions

2

Solved

I have an enumeration in my Data layer and I want to use its drop down list in my website project. My enum in Data layer is: namespace SME.DAL.Entities.Enums { public enum EntityState { O...
Meraz asked 7/2, 2014 at 8:43

3

Solved

I'm trying to understand c# ASP.NET MVC4 and keep coming across SelectList. I can't seem to find an explanation of what it is, other that this: http://msdn.microsoft.com/en-us/library/system...
Seda asked 6/8, 2013 at 13:4

1

Solved

There is a view displaying 5 dropdown lists populated with all available courses from relevant table: @model StudentRegistrationPortal.Models.CourseRegisterModel @{ ViewBag.Title = "registerCours...
Homogony asked 29/7, 2013 at 12:0

3

Solved

I am using ASP.NET MVC 2 (.NET 3.5), and need to manually define what shall be an Options list. When I do so I get a drop down menu, with each of the manual entries reading 'System.Web.Mvc.SelectLi...
Pitchblende asked 17/9, 2010 at 15:54

4

Solved

I have an array initialised in script var listarray = new Array(); And have a dynamically created select list --- <select multiple size=6 width=150 style="width:150px" name="ToLB" > <...
Glottalized asked 23/4, 2013 at 7:44

10

Solved

Am I right to think that there is no way to set the selected value in the C# class SelectList after it is created? Isn't that a bit silly?
Panathenaea asked 19/11, 2008 at 13:16

2

Once again I'm confronted with a "This shouldn't be this ?*!# hard" situation. Problem: I want to use a form in MVC for creation of an object. One of the elements of the object is a set of limited...
Amboceptor asked 26/5, 2010 at 22:1

1

Solved

Currently I have SelectList that writes ID, and shows FirstName on the form. ViewBag.Person = new SelectList(db.Person, "ID", "FirstName"); How to concatenate FirstName and LastName into SelectL...
Fourposter asked 4/2, 2013 at 12:44

1

Solved

I am currently working on a Grails application and I am looking place a select list on the page and have its Key set to one value and the Value set to another. The code of all related elements is b...
Chardin asked 6/11, 2012 at 15:26

2

Solved

For my web app I have a selection list coded as below; <select name = 'job' id = 'job'> <option value = 'jobselect'>Select Profession</option> <option value = 'job1'>Mechan...
Isobaric asked 11/10, 2012 at 13:37

1

Solved

I want to select value from select list in RSpec. For example i have such data: <div class="control-group"> <label class="control-label" for="user_teacher_leader_attributes_teacher_id"&g...
Byington asked 7/4, 2012 at 15:6

1

Solved

Currently our dev team uses this pattern, but I can't help but wonder if there is a faster or more html-efficient way of accomplishing the same task. HTML <select id="myList" style="width: 400...
Ornithischian asked 3/4, 2012 at 14:9

5

Solved

I have the following two methods that get data from my DB and return a populated SelectList object (including an "All" option value) that I then pass onto my view. The problem is that they are almo...
Cassaundra asked 27/12, 2011 at 20:40

1

Solved

(sorry, there are several item here but none seems to allow me to get this working.) I want to create a DropDownList which allows multiple selection. I am able to populate the list but I can't get...

1

Solved

I'm trying to unit test a function which returns a SelectList. How can I retrieve an item from the SelectList to verify that my model is being constructed correctly? mySelectList.Items.First().D...
Subsistent asked 24/8, 2011 at 15:49

3

How am I able to create a list with the last 5 years in it, such as the years 2011 to 2007. I don't want to hard code the years, but I want the most recent 5 years based on the current year.
Guck asked 19/7, 2011 at 8:53

2

Solved

Using MVC3 I have found that setting a SelectList's selected value correctly renders the view on an HttpGet, but fails to render correctly on HttpPost. I have inspected the Model before they are fo...
Sendal asked 5/5, 2011 at 5:47

1

Solved

So I have a SelectList being generated in this method: public static SelectList HolidayDays() { SelectList retval = GenerateKeyValueList<HolidayCity>(HolidayCityHelper.GetFriendlyName, Holi...
Katiekatina asked 10/1, 2011 at 21:36

2

Solved

As you can see here and here I'm not a good friend of asp.net MVC's SelectList. This time I'm wondering how to count the items in it. I want to show a label instead of a dropdown if the possible it...
Upthrow asked 19/11, 2008 at 13:42

2

Solved

I am trying to create a form in ASP.NET MVC2 RC 2 that is based on a calendar event object. The object has eventTypeId which is a System.Int32 that I need to populate with via a select list. The c...

2

I'm working on having a multi-select list where you can have items selected and then click an "Up" or "Down" button that will allow you to reorder those items within the list. I've got a simple se...
Crissman asked 16/11, 2010 at 15:37

2

Solved

I feel my question is close to this one, but I want a more general discussion on where code like this should sit. Asp.Net MVC SelectList Refactoring Question? I currently create my selectlists dir...
Fieldfare asked 19/9, 2010 at 17:47

1

Solved

I'm extending an Enum and, given the following code, selectListItems is a generic List of SelectListItems that has all the correct values for my Enum. The first foreach loop works fine. However, w...
Lyndsaylyndsey asked 30/6, 2010 at 16:0

5

Solved

I'm just wondering where people are creating their SelectList - in the action or the view. I have seen examples of both and the one that makes the most sense to me is doing it in the action and h...
Neutrophil asked 8/2, 2010 at 1:36

2

Solved

When you have a domain object that needs to display as an interface control, like a drop down list, ifwdev suggested creating an extension method to add a .ToSelectList(). The originating object i...
Electrify asked 6/4, 2010 at 21:48

© 2022 - 2024 — McMap. All rights reserved.