selectlist

How can I restore the order of an (incomplete) select list to its original order?

I have two Select lists, between which you can move selected options. You can also move options up and down in the right list. When I move options back over to the left list, I would like them to retain their original position in the list order, even if the list is missing some original options. This is solely for the purpose of making ...

Selecting an item in an HTML SELECT list using keyboard doesnt trigger the CLICK event

I have an HTML select list which, when an item is selected, must show different information beneath it. The onclick or JQuery change events are triggered when a select list item is selected by being clicked on (mouse), but not when the user uses key presses (keyboard). Any idea what event to watch in order to determine when the selected...

Filtering a select list via input box & jquery

Hi all, I was wondering if i could get some help with filtering a select list using an input box via jquery. Here's what my js looks like, but it doesnt seem to work. I'm guessing this is because options within a select list are not hide-able. <script type="text/javascript"> $(document).ready(function() { $("#inputFilt...

select list modified on-the-fly doesn't fire onChange() for new first element.

In the code below, I'm using jquery 1.4.1 to modify the options in a select list when the user clicks on the list (replacing the single Old item with three New items). Selecting either New 2 or New 3 correctly fires the change() method (and show the alert), but selecting "New 1" does not. What am I missing? Thanks. <html> <head> <scr...

How can I combine two fields in a SelectList text description?

I want put in a selected list labels the name and surname of people of an EF model. I've tried with this: public ActionResult Insert() { ViewData["accountlist"] = new SelectList(time.Anagrafica_Dipendente.ToList(), "ID_Dipendente", "Surname Name", null); Giustificativi g = new Giustificativi(...

Change a select list display value upon selecting description

Hello, I would like a select list that does the following: When the select list is open, display the list of descriptions. When the user selects an item, the select list will close an only the value will be displayed. The reason for this is to conserve space as the values will be much shorter. I'm hoping that there's an answer in jQ...

Drupal taxonomy multi-select default value

I'm using drupal 6.16 and have a set of taxonomy terms that are set up as a multi-select box. I would like for the first item to be selected when the user loads the page. I dont know if I need to add code to a file or just simply change a setting. I should warn you I do not have a lot of experience, but would rate myself as a low inter...

There is no ViewData item of type 'IEnumerable<SelectListItem>' that has the key 'xxx'.

There are a couple of posts about this on Stack Overflow but none with an answer that seem to fix the problem in my current situation. I have a page with a table in it, each row has a number of text fields and a dropdown. All the dropdowns need to use the same SelectList data so I have set it up as follows: Controller ViewData["Submar...

SelectList in Asp-mvc and data from the database

Hello guys. I'm having some troubles with SelectList in ASP.MVC. Here is the issue: I have a Create View and begind a ViewModel model. The page load just fine (GET verb). But when posting, something happens, and my model is considered invalid, and it cannot insert. Here's what i've tried so far. public class DefinitionFormViewModel { ...

Binding to a SelectList in MVC

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 choices - a perfect candidate for a drop down list. But if I use a SelectList in my model, and a drop down list in my View, and then try to ...

Style Option Elements in Select List (Add Padding and/or Margins)

Is it possible to style the option elements of a select list/dropdown beyond background and font? I'm specifically looking to add some padding/margins so the list isn't as cramped. ...

how do I get my selected list back with the selected item (asp.net mvc 2)

Hello, I try to make a view in ASP.NEt mvc 2 with a selectList. I fill up the selectlist languages from my model (regDom) listLangModel is a list of languages I retrieve from the database. regDom.Languages = from l in listLangModel select new SelectListItem { Text = l.Na...

Possible to disable/make item not visable in select list?

Is it possible to make an item disabled/not visable in a select list? What I'm trying to accomplish is to, depending on a number of checkboxes, if they are selected, the fields should appear in the dropdown. However, I do have manditory fields that always should be in the dropdown and it should all be in a serten order. Checkboxes: <...

Problem with ASP.Net MVC SelectLIst and List<SelectListItems>

Hi I have the following code: foreach (SelectListItem item in selectListItems) { string tex = item.Text; string val = item.Value; string sel = item.Selected.ToString(); } SelectList selectList = new SelectList(selectListItems); foreach (SelectListItem ...

Populating properties on my Model with values from a SelectList when I post

I'm building an Asp.net MVC 2 application. I have an entity called Team that is mapped via public properties to two other entities called Gender and Grade. public class Team { public virtual int Id { get; private set; } public virtual string CoachesName { get; set; } public virtual string PrimaryPhone { get; set; } ...

jQuery - modal dialog form loaded via .load() multiple times and select list breaks

Hi, I am loading content with jquery.load() (1.4.2), which includes a form that I turn into a model dialog. When I open the dialog, I dynamically populate a form select list. It works the first time I load the content, but on subsequent loads it breaks and will only return the last selected item from the previous load. (I also think i...

ASP.NET MVC: DropDownList -- Of DataSource, SelectedItem, and inline code access within the View

As far as I can tell, there are 3 ways to create a DropDownList in an ASP.NET MVC View: Hand code the HTML manually <asp:DropDownList ID="someID" runat="server"></asp:DropDownList> <%= Html.DropDownList("someID") %> I think we can all agree that #1 is (generally) a waste of time. With #2, it appears to be the "WebForms" way of doing...

Problem with Select List control in asp.net web mobile application.

Hi, I am trying to develop the single page in asp.net web mobile application as code behind c#. I have took the Mobile select list control on page.It has items, 1,2,3,4,5,6,7,8...20. I want it should be assign the selected value of select control to mobile label control situated on page (Mobile Form). As per i know I have to code this on...

Jquery - three select lists, deactivate the other two if one is value is selected

I have three drop down select lists, when a value from one of the list is selected, I want the other two to be greyed out and inactive. I have id wrappers around each select list that I'm experimenting on, but as I am new with jquery I'm not getting very far. ...

Create Selectlist with separator in Html Helper

I'm trying to build a select list that will contain some prioritised values, then a separator, and then the rest of the values. I need to do this in a Html Helper, as I will get the values that will be prioritised and the rest of the values from different sources. Sample of what I want to accomplish: EUR GBP USD --- SEK ZAR . . . I ...