dropdownlist

post <Asp:DropDownList> value with action link (asp.net MVC JQuery)

I have an on my MVC View page. I use JQuery to filter a grid when the selected index changes. At the bottom of the page I have an action link that. I would like to post this value to the controller that the action link is pointing to. The problem is, obviously the value of the box can change. How could I post dynamically changing d...

Why is the asp.net dropdown list button color tied to the windows color?

The ASP.NET dropdownlist control has an arrow that you can click to drop the list down, that color of the arrow is tied to the users windows color scheme. This is not convenient for me and I'll need a workaround. However, I'm wondering if anyone knows (or has a guess) the strategy behind making that dropdown arrow tie to the system col...

Keeping Drop-downs DRY in a web app

I'm writing a CMS for various forms and such, and I find I'm creating a lot of drop-downs. I don't really feel like mucking up my database with tons of random key/string value tables for simple drop-downs with 2-4 options that change very infrequently. What do you do to manage this in a responsible way? This is language-agnostic, but ...

Custom dropdownlist with items autopopulated

I have the need for a dropdownlist with the U.S. states in it. I could need this dropdownlist on various pages. Instead of always having to create a listitem for each state, I want a simple control. I don't want a UserControl - I want to extend the existing dropdownlist control. I know I have done this before at a previous employer, ...

Best way to create a dynamic Select (Dropdown) list?

I'm using jQuery and jqGrid. I'm trying to populate a select list dynamically, one for each row and I need to add a click event to it. When the select list is being populated I grab the index of the item I want selected, and then after all items are add I'm trying to set the selected item. I've tried $("#taskList")[0].selectedIndex ...

Support for optgroup in dropdownlist .NET MVC?

Continuing on from this question programmatically creating a drop down list I would like my list to have several optgroup lists too. Is this currently possible? I know I need to pass a selectList to a dropDownList but do not know how to add text,value,optgroup to the selectList. I want the end result to produce: <option value="">Pleas...

Populating dropdownlist with selectlist in ViewData

I am trying to populate an HTML.Dropdownlist with a selectlist which is populated with a string value (a location address) and text (a location description) fields from a database call. I am passing the selectlist as viewdata to my view. The dropdown populates fine but when I go to use the value it is null or empty as seen by an alert I ...

Dropdownlist value not getting set from SelectList passed to view in ViewData

I am trying to populate a dropdownlist of office locations(text) and addresses (value) When viewing my page source in my browser after displaying the page I can see that the select (dropdownlist) option values are all "". Here is my code. I am using a LinqToSql data context call to get my data for the SelectList. In the debugger I can s...

CascadingDropDown Error - 'options' is null or not an object

I have five DropDownLists linked together with the CascadingDropDown AJAX control. When it's running locally, they work fine. However when running on the production server over the internet, I get this error every time I select a new item: 'options' is null or not an object Debugging this shows the function that's causing it (it's JS ...

Dynamically created DropDownList loses ListItems on Postback

I have a page that contains some dynamically created controls (TextBox and DropDownList). When a postback occurs, the TextBoxes keep their values, but the DropDownLists lose their ListItems. This is quite confusing, since the page level DropDownList also keeps its ListItems. Can anyone see what's wrong with the code below? Any help in ...

Enable a Currently Disabled Dropdown List when Clicking the Dropdown List

Here is the scenario: I have two radio buttons, 1) for a normal customers and 2) for business partners which also has a drop down control so that one of X number of business partners can be selected. When one customer type is selected the other section goes dark with the normal disabling of controls and applying CSS to get that disable...

ASP.Net MVC - dropdown list for associated objects

I have two models in my application: Product and ProductType. Product has a reference to ProductType (in the DB it's named ProductTypeId), while ProductType has two columns (Id and Name). I can get the dropdown to be properly populated and displayed on the forum using the following code: Controller: var typeList = new SelectList(_en...

Populate DropDownList from XmlDataSource

Hello, I'd like to populate my DropDownList using a simple xml file: <?xml version="1.0" encoding="utf-8" ?> <Databases> <Database>foo</Database> <Database>bar</Database> <Database>baz</Database> </Databases> My XPath is /Databases/Database My drop down list is rendered as: <select name="databaseDropDownList" id="databaseD...

ASP.NET 2.0: Calling a javascript function from onChange with AutoPostBack=true

I have an ASP.NET DDL that looks like this when I view source: <select name="testControl" onchange="DoCustomStuff();setTimeout('__doPostBack(\'testControl\',\'\')', 0)" id="testControl"> It looks like this on the .cs page: <asp:DropDownList ID="testControl" runat="server" onchange="DoCustomStuff()" OnSelectedIndexChanged="testControl...

Rails non-table drop down list

I need to have a drop down list in which the user selects the day of the week they want to come in every week. The values will never change right. It's just Sunday, Monday, ..., Saturday right? It seems like more work than needed to make a table and put the days of the week in. I certainly don't need the ability to create, update or de...

How to make a dropdownlist disabled on change event using JQUERY ?

$(document).ready(function() { $('#<%=ddlContinents.ClientID %>').change(function() { var element = $(this); var totalLength = element.children().length; if ($(this).disabled == false) { $(this).disabled = true; } }); }); What I am trying to do is fire off the change event of the dropdownlist and on chan...

How to generate text from dropdownbox while clicking

for example dropdown box contain three things Simon,Jaison,Rahul..if you click Jaison will generate jaison as a text,,or Simon will generate Simon as a text ...

Databound FormView linked to DropDown, How to set initial item?

I have a dropdown bound to a datasource, this dropdown is also used to select the index for the FormView on the same page. As per ASPNET examples How do I set the initial item, so when the EditPage containing the DDL and Formview is displayed it is displaying a certain item? ...

dropdownlist doesn't reset on page reload

Hey,...very simple question I usually write php but happen to be programming with ASP.NET 3.0 framework now and can't figure out how to fix this. I have a DropdownList and if I selected a some value,...my code behind does a bunch of stuff and outputs the data...... Now,...if I reload the page (ie. press F5 or the little reload thing o...

DropdownList reset to to index 0 on load

Hi, How would I reset my asp:DropDownList element (which has a runat="server") to index 0 every time the page is "reloaded" in firefox (F5 is pressed). If you suggest using javascript...please note that A: I am not using a form and B: I don't know how to access elements that have a runat="server" with javascript If this can be done us...