473,406 Members | 2,345 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Strange problem with dropdown list - always selects the first item

Hi All:

I'm having a strange problem with the dropdownlist. Here is what is
happening:

I have a webform on which I have a whole bunch of controls. The form has 2
dropdownlists. The dropdowns are bound. The items are loaded just fine into
the dropdown lists at the time of page load. When I try to select an item
from the dropdown list, it always ends up selecting the first item.

1. I have set the autopost back to true
2. The selectedindexchanged event does not fire.

Does anyone have any idea what is happening?

Vinay
Jul 21 '05 #1
3 1808
Hi Vinay

I believe you are using something like this
ddlSubActivity.SelectedIndex = ddlSubActivity.Items.IndexOf(ddlSubActivity.Items. FindByValue(cstrSubActivityValue)
I believe you are populating the dropdowns in same functions
If so , try to use the above code after you have bound the second dropdown also. do not do immediately after bindin
the first dropdow

Satish

Jul 21 '05 #2
Hi Vinay,

Show some code maybe we can help you than better.

Cor
Jul 21 '05 #3
Hi Satish/Cor:

Thanks for trying to help. The problem was in my code. I am binding the ddl
to an arraylist that consists of objects. The class defn for that object was
messed up which led up to this - a typo was the culprit!

Thanks again :)

Vinay

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:Om**************@TK2MSFTNGP09.phx.gbl...
Hi Vinay,

Show some code maybe we can help you than better.

Cor

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: San Smith | last post by:
I have a dropdown list box with list of item. When I read the data from database I want to display that value(one of the item in the drop down box) in the dropdown list box. How to do that in a...
3
by: Vinay | last post by:
Hi All: I'm having a strange problem with the dropdownlist. Here is what is happening: I have a webform on which I have a whole bunch of controls. The form has 2 dropdownlists. The dropdowns...
6
by: | last post by:
Do you have to use AutoPostBack to read the selected value in a dropdown list? I have an asp.net dropdown on a form. I'm filling it from a table when the page loads and want to read the value the...
2
by: Brian | last post by:
Hi, All, I have two dropdown lists in itemtemplate in a datagrid. for example, dropA and dropB. also, for the dropdown, I set < Runat="server" AutoPostBack="True" OnSelectedIndexChanged="some...
5
by: ~john | last post by:
I'm adding a DropDownList to my page in the code behind which is set to AutoPostBack... The problem is it's giving me the same SelectedValue on every post back, the value of the first item in the...
6
by: nishac | last post by:
Can anyone suggest me how to make my drop down menu work in IE7 too.Its working in other browsers.On mouse over the submenus should be displayed.Am attaching my css code hereby.Anyone please check...
2
by: JJ297 | last post by:
I have a dropdown list populated via a database. I edited the dropdown list to have "select a topic" to always appear when the drop down loads. Now if a user selects a dropdown item it goes into...
0
by: Andrus | last post by:
SWF ComboBox dropdown menu first item selection must open picklist. For this I use the following code: protected override void OnSelectedIndexChanged(System.EventArgs e) { if (SelectedIndex != 0...
8
by: sheldonlg | last post by:
I am still improving my AJAX and I ran into something that I'm not sure how to do. I will have a page called where I will have a dropdown list at the top and a large display at the bottom. The...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.