dropdownlist

get selectedValue of dropdownlist from code behind

On an aspx page I have a dropdownlist and a button. I select a value from the dropdownlist and click the button. In the button event handler I have the statment: DropDownList1.SelectedValue; This value is showing up as the first item in the list regardless of what item is actually selected. Same result with .SelectedItem.Value and ....

ASP.NET MVC DropDownList: Getting the Selected Text (rather than the Value)

Once upon a time, I had a DropDownList with Options built using this code: <%= Html.DropDownList("SomeName", someSelectList)%> which produced HTML like this: <select id="SomeName" name="SomeName"> <option>ABC</option> <option>DEF</option> <option>GHI</option> <option>JKL</option> </select> Form Submission would always return one of...

Changing Input Fields Html / JavaScript ?

Hey, I have these input fields, well 1 input text box, and then i have a drop down. Now what I want is when a user selects an option from the dropdown (this is the dropdown) <select name="searchType"> <option value="all">All</option> <option value="music">Music</option> <option value="movie">Movies</option> <option value="...

get previous selected dropdown item

i have the following code where i have a dropdown list (with class="addToList" and followed by a button (Class="addtoButton"): When i click on the button, i want to grab the current selected value and text from the previous dropdown list. $(".addToPortalButton").live('click', function (e) { // grab the previous dropdown list value and...

How to Enable/Disable asp.net button when a dropdown list selected value changes?

Hi All, I have a couple of dropdownlists and a button.when a user selects an item in the 1st dropdownlist,the 2nd dropdown is programmatically bound to a set of items(using an ajax request) depending on the value selected in the 1st dropdown.Then the user will have the ability to choose an item from the 2nd dropdown and click on the but...

ASP.NET MVC 2 DropDownList Selected item changed?

I have a drop down list on my aspx form and what I want is to refresh the site after I select an item from the list. This is my drop down list: <%: Html.DropDownListFor(x => x.CompanyUserFilterId, new SelectList(Model.CompanyUsers, "Id", "FirstName", Model.CompanyUserFilterId))%> I use it to filter the data shown on the form dependin...

How to show two strings in ASP.NetDropDownList SelectList dataTextField?

This is my DropDownList in ASP.Net: <%: Html.DropDownListFor(x => x.CompanyUserFilterId, new SelectList(Model.CompanyUsers, "Id", "FirstName", Model.CompanyUserFilterId)) %> I want to list all CompanyUsers in the DropDownList and show both their FirstName and LastName property. CompanyUsers is an IEnumerable property. The code above w...

Facet field not filtering results

Hellos, I am trying to filter results from a search against Solr depending on a field. I was usiing this piece of code in page.xhtml: <h:selectOneMenu id="lang" binding="#{myBean.myMenu}" onchange="javascript:refreshResults(); return false;" > <f:selectItem itemValue="" itemLabel="Language" /> ...

exception handling for databound dropdowns in listviews

One common scenario we run into is with a drop down being databound inside the edit template of a ListView. This usually works pretty well, but I cannot figure out a good way to handle exceptions, for example, look at this error from our website: Server Error in '/' Application. 'ddlLender' has a SelectedValue which is invalid because...

best practice for what is in a ViewModel

I am wondering if it is a good idea or bad, placing things like a List of countries in ViewModel, for binding to a drop down list? For example on a site's Registration page. I was under the impression that a ViewModel is supposed to represent an instance of the filled out form, but I think I may be wrong as I have seen other people put ...

Dynamic Spark DropDownList ItemRenderer within Flex Datagrid

I have a datagrid which contains a Spark dropdownlist that needs to obtain dynamic data. The datagrid uses a separate dataProvider. When I use a static ArrayCollection within my ItemRenderer, it works (please see listing 1). However, when I use Swiz to mediate a 'list complete' event to load the ArrayCollection, the dropdownlist does n...

Does an absence of EnableViewState in a DropDownList default to False even if VS 2008 implies True?

While debugging a postback problem with a DropDownList within a Repeater I discovered that even though everything looked like it was set up correctly the selections from the user on the DropDownList were not being restored from the view state. My DropDownList was defined as <asp:DropDownList ID="EmployeeColumnDropDownList" runat="serve...