dropdownlist

Bind SelectedValue of ASP.net DropDownList to custom object

Currently I have a DropDownList inside a FormView, databound to an ObjectDataSource. This is the DropDownList, which has it's own datasource, which returns a List of Departments: <asp:DropDownList ID="DepartmentsList" DataSourceID="DepartmentsListDataSource" DataTextField="Name" SelectedValue='<%# Bind("Department") %>' runat="server" /...

Why am I getting InvalidCastException passing a string to a VariantType parameter?

I have: Protected Sub SepInsert(ByVal mriId As VariantType, ByVal aeId As VariantType, ByVal absId As VariantType) ... End Sub and want to call it with a DropDownList selection like this: Protected Sub cmdNewPrelinkedMri_Click(ByVal sender As Object, ...

ASP.NET Dropdown List in Codebehind vs in ASPX page

I am generating a dropdown list in codebehind and cannot get the selectedindexchanged event to fire automatically. It works fine when put directly into the ASPX page, but I need it to be in the codebehind. This doesn't work - var deptList = new DropDownList { ...

How to set DropDownList selected item in markup?

I have a DropDownList in a template column of a GridView control. The GridView is bound to a list of objects. Each object has a property of type int which corresponds to a value in one of the DropDownLists ListItems. I could set the selected item programatically by adding a DataBind event to the drop down, but I'm wondering if there's...

populating a table from sql server through vb.net including dropdownlist and checkboxes

this is the scenario. I have 1 aspx file with a table in it. it has a .aspx.vb file behind it. i want to populate this table from the .vb code. the table shall have many lines (rows) but they should be in this format. also the checkbox data, textbox data and dropdownlist data comes from database behind. how should i go about thi...

Best practice for loading a lot of DropDownLists in asp.net MVC 2

Hi, I have many pages with many dropdowns in them and I am wondering whats the best practice for filling all those dropdowns in an MVC 2.0 app, am thinking of creating a template for all because I wanna use special script on each one, but what about using ajax to initially load the dropdownlist items values. maybe through creating a co...

UltraWebGrid dropdown changed event

If you have defined a column and set the type to dropdownlist how do you intercept the event when the selected item in the dropdown changes? What I am attempting to do is populate the first column with a dropdown. Once a value there is selected I will populate the remaining column from the choice made in the dropdown. I am just not su...

Flex - How to change open DropDownList height

Using FB4, I want to change the height of an open spark DropDownList. By default, it shows up to 6 items before scrolling. My dropdownlist contains 7 items, so I want to change the height of the open dropdown list to fit all 7 items without scrolling. As a workaround, I've changed the font size of the items so that they are smaller and a...

Problem with GridView, Bind() and DropDownList

I am updating an existing ASP .NET site. This site has a custom grid control class that extends the GridView control to add a few features. Many pages in the site use the built in declarative two-way binding feature that is built into the base GridView, i.e. column templates make calls to Bind() so that data can be shown and updated auto...

ASP.NET MVC 2 - Html.DropDownListFor confusion with ViewModel

I'm getting totally lost and confused on how to use the new strongly typed Html.DropDownListFor helper on ASP.NET MVC 2.0 R2 In the View I'm writting: <%= Html.DropDownListFor(m => m.ParentCategory, new SelectList(Model.Categories, "CategoryId", "Name", Model.ParentCategory), "[ None ]")%> <%= Html.ValidationMessageFor(m => m.ParentCa...

asp.net mvc dropdownlist no ViewData item

i start to study mvc, try to add dropdownlist, make construction <%= Html.DropDownList("ddl") %> but it show error There is no ViewData item of type 'IEnumerable' that has the key 'ddl' why? i use simple code, only pass name parameter, so why the error? ...

[Javascript] How to iterate through multiple dropdown lists and access their option values

I'm writing the code for a basic GPA calculator. Basically, it's a 3-column-table, two text areas for the course name/credit hours and a dropdown list that contains letter grades (A+, C, B-) and their corresponding point values as the option value, like this <td><select name="letterGrades"> <option value="0.7">A+</option>> <option value...

dropdownlist jquery ddl.change() seems to fire before change takes place

Hi I have three cascaded drop down lists. ddlIllnessType, ddlIllnessSubType and ddlInfectiousAgent Initially, only ddlIllnessType is showing. On change, ddlIllnessSubType is filled with json data and made visible. So far, so good. Next, when the user selects a value from ddlIllnessSubType, a similar procedure runs for ddlInfectious...

ASP.NET MVC Drop Down List

Hi! I'm a newbie with ASP.NET MVC and trying to bind a Drop Down List with a data from a database. I'm making a computer packet calculator application, basically the users can select components he/she wants into his/her computer packet from a drop down list and then send the order into a email. The components must come from a database. ...

Can I populate list items in a ASP.NET dropdown list from a ASP.NET Placeholder?

I'm designing my own custom control that contains a .NET dropdownlist. What I'm wondering is if it is possible to populate my dropdownlist with listitems placed in a placeholder? For example: <asp:DropDownList ID="ddlFilter" runat="server" > <asp:PlaceHolder ID="ListItemPlaceholder" runat="server"/> </asp:DropDownList> This doesn't...

How to create new Control depending on SelectedValue in a DropDownList

I have a with dynamic values from an Enum like: String, Int, Double, Bool, DateTime. How do I create a new Control depending on what is the SelectedValue dynamically into the page? I want a CheckBox for Bool, TextBox for String, Calendar for DateTime etc. ...

Asp.NET dropdownlist in usercontrol not firing SelectedIndexChanged event

Asp.Net 2.0 framewrok - VB.Net application I have a UserControl containing a Asp.Net DropDownList. Things already researched and \ or tried: The control gets bound to data on page load inside if not Page.IsPostBack (only loads once) ID proprety is set for control (ID = ddlMyControl) AutoPostBack is set to true EnableViewState on the ...

Is it possible to put a combo box (drop down list) in a MS Access MsgBox?

There is a combo box (dropdown list) with a list of revenue types. If the user types into the box a value that is not part of the list, a msgBox pops up and asks them if they want to add that value to the list. Here is my problem: In that msg box, I want to give the user a combo box list of revenue groups to choose from (so that the ess...

add a value to a dropdownlist populated from database in vb.net

this is my code - SqlCmd = New SqlCommand("sp_load_names", SqlCnn) SqlCmd.CommandType = CommandType.StoredProcedure SqlDR = SqlCmd.ExecuteReader() While SqlDR.Read ads_list.Items.Add(New ListItem(SqlDR(1) & "")) End While SqlDR.Close() this shall populate the dropdownlist data, but in the value i need it to pick up the "ID...

populating dropdown list in vb.net

i have a dropdownlist that populates from the sql server database. populating the list is not a problem, but does anyone know how to populate the value part of the listitem. e.g = black blue orange red violet how do you populate the value=1,2,3,4,5 when you're populating from table in database? ...