dropdownlist

Selected ListItem in Datasource not Selected after DataBinding

I'm selecting a ListItem as I add it to a ListItemCollection. Then I use that ListItemCollection as a datasource for a DropDownlist but the Selected List Item is not being selected after databind. Here is an example of the code: ListItemCollection items = new ListItemCollection(); ListItem item; item = new ListItem("Option 1", "1"); i...

Populating ASP.NET MVC DropDownList

OK, I've been Googling for hours and trying everything and can't get anything to work. I am learning MVC using Sharp Architecture and have generated some basic forms for creating Client objects. I want to fill the state drop down list with a list of US states and let the user pick from that list. I am able to populate the list and get th...

dynamic dropdownlist in asp.net

hello I created dropdownlist at runtime when a button is clicked.and i palced another button to get the selected text from dynamic dropdownlist.When i try to retrieve the selected text from dropdownlist it gives me the error called object reference not set, following is my code. TableRow tr; TableCell tc; DropDownList dp; T...

How do I fill a dropdownlist on mouse event with jQuery?

Lets say that I have a drop down list that I want to create "on the fly" when the user interacts with it. For example: the drop down list only has the the option "Attach a file". When the user clicks/interacts on the drop down list, I need for it to generate, at that moment, all the available files they can attach (which depends on o...

Asp.net - Creating 2 linked Drop Down Lists from Database

I have 2 linked database tables (Similar to Country -> State) - how can I dynamically populate 2 drop down lists with these tables such that: If I pick a Country, only the states for that country show up in the second drop down list? Update: There seems to be a solution on this page -> http://stackoverflow.com/questions/936499/populate...

Drop Down box Image change problem

Hi there, Im a noobo in the world of Javascript but am trying to get my heard around it (shouldn't take too) Basicly what im trying to do is the following I have a drop down box that when changed will change an image, which i have got to work using the following cose <HTML><HEAD><TITLE>JS1</TITLE> <script LANGUAGE="JAVASCRIPT TYPE="TE...

How can I get the text of the selected item from a dropdown using jQuery?

I need the text from the selected item in a drop down. Thanks in advance! ...

Help With A Method For HTMLdecode DropDownLists Please

I have several DropDownLists on a form which are dynamically populated as they move down the form pulling data from a DB. The data is all HTMLEncoded so I need to HTMLDecode the data to display the text. I created a method to do this and trigger it 'ondatabound' for each DDL ondatabound="SortHTMLModel" BUT whats annoying I have th...

ListItems attributes in a DropDownList are lost on postback?

A coworker showed me this: He has a DropDownList and a button on a web page. Here's the code behind: protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ListItem item = new ListItem("1"); item.Attributes.Add("title", "A"); ListItem item2 = new ListItem("2")...

Dynamic Dropdown list with actions

like 1 image says more than 1000 words. here is what I want to implement in a django webapp: http://bit.ly/1ocI0X Is a dynamic dropdown list with an action to add values to db and dynamicly added to self dropdownlist. Any hint would be appreciated. Tks. ...

Gridview, DropDownList, EditItemTemplate - Error: SelectedValue which is invalid because it does not exist in the list of items

I have a Gridview which binds to an ObjectDataSource (objStudentDetails). In edit/insert mode of the Gridview one of the fields is a DropDownList that gets it's pick list options from a lookup table. I have this DropDownList binding to another ObjectDataSource control (objStateList) which represents the lookup table. It works fine as ...

MVC - UpdateModel and DropDownLists

Hi I am doing MVC and have look-up values in drop down lists. When calling UpdateModel only values before the look-ups get updated and nothing afyer. I get no errors though. I can edit and create and use the following code in my cintroller: ViewData["SiteMaintenanceId"] = from m in this._siteRepository.FindAllSiteMaintenances().ToLi...

Problem: textbox does not fire its TextChanged event after typing some text?

I have a we form (.aspx) that has several controls such as dropdownlist, textbox(textbox1), ... The dropdownlist's autopostback is true and when I change the selected index of it, based on what index I have selected, a text is written in textbox1 and then because the autopostback of textbox1 is true, 2 other textboxes fill themselves ba...

asp.net drop down list not selecting any value.

At btnSave - button event-handler, in the following two lines, SelectedValue is always returning null. not.TargetSessionCode = this.sessionsDropDownList1.SelectedValue; not.CourseCode = this.coursesDropDownList1.SelectedValue; Can anyone say why? This is my aspx code: <%@ Page Language="C#" MasterPageFile="~/MasterPage.Master" Auto...

'EnableViewState = false' of an asp.net DropDownList

If an asp.net DropDownList's is set to EnableViewState=false, DropDownList.SelectedItem returns null. Then what technique can I use to get the SelectedItem of that DropDownList while keeping that EnableViewState=false? ...

Page Post back initializes the dropdownlist.

I face a weird problem. I have a simple aspx page with a dropdownlist. The dropdown gets filled through a function which is called from Page_Load() event. The dropdown item selection triggers event OnSelectedIndexChanged. Now the event triggers rightly but what happens that upon post back the dropdownlist gets initialized, that is, it sh...

Working with NHibernate, ASP.NET MVC and Dropdown

We're using ASP.NET MVC together with NHibernate and we'd like to create several Dropdown Lists using Values (custom Class) from the Database. This actually works, but how do I handle the "Empty" value; I mean, the "unselected" DropdownValue? Something like "-- Select --" on the top of the List... Does anyone have experience with this co...

How to get the value of datafieldtext or selectedtext of the selectlist in asp.net mvc?

No javascript\AJAX is to be used. ...

Dropdown with Checkboxes

Looking for an open source .net control that functions like this: http://www.obout.com/combobox/cbo_integration_databound_checkboxlist.aspx Can anyone point me in the right direction? ...

ASP.NET Populate a dropdownlist based on the changed event in another dropdown

I want to populate the dropdownlist ddVerantwortlich1 with the people with the proper credentials based on the selected process step ddProzessschritt1 It doesn't work if I want to change it using datasource and databind i have to manually loop through the table in the dataset returned from the query. then it works. but not otherwise......