473,406 Members | 2,705 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.

dropdownlist does not retain its selectedindex value on postback.

Hi,

I have a dropdownlist in a grid header template - i have autopostback on but
when i check the selectedindex in the page_load event (i have a routine
which identifies the control that caused the postback and it determines the
dropdownlist correctly) it is always 0 - i am NOT rebinding to the
dropdownlist in the page_load event i.e. only once if !postback. I also have
viewstate set to true for the control and the grid it is in! The grid is
embedded in a nested set of html tables. Any idea why the selected index is
not retained..and also when the page is redisplayed after the postback the
dropdownlist is reset to the first item in the dropdownlist?

Thanks for any help!

Any ideas?
Nov 19 '05 #1
2 4633
"John Blair" <jo********@hotmail.com> wrote in
news:i9*****************@newsfe4-gui.ntli.net:
I have a dropdownlist in a grid header template - i have autopostback
on but when i check the selectedindex in the page_load event (i have a
routine which identifies the control that caused the postback and it
determines the dropdownlist correctly) it is always 0


Do you by any chance have a SelectedIndexChanged handler? That is where the
SelectedIndex gets updated.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #2
Hi,

Thanks for the feedback.
I found out the cause of my situation - my grid is in a web page that also
includes an XML control - that thru XSLT generates a variety
of <Form></form> tags that when embedded in the main page <form> tag causes
the selections to go amiss - removed the XML control and all worked
perfectly!

Thanks.

"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn***************************@127.0.0.1...
"John Blair" <jo********@hotmail.com> wrote in
news:i9*****************@newsfe4-gui.ntli.net:
I have a dropdownlist in a grid header template - i have autopostback
on but when i check the selectedindex in the page_load event (i have a
routine which identifies the control that caused the postback and it
determines the dropdownlist correctly) it is always 0


Do you by any chance have a SelectedIndexChanged handler? That is where
the
SelectedIndex gets updated.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 19 '05 #3

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

Similar topics

4
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new...
2
by: Benedict Teoh | last post by:
I created a dropdownlist containing day, month and year field and expose a property to assign a date. When I call from a aspx page and assign the value, the new date is not displayed until a submit...
2
by: Wee Bubba | last post by:
i have a dropdownlist consisting of titles (Mr,Mrs,etc.). I use the text property to store a title and the value properties to store a default gender code. e.g. Title Default Gender ----...
6
by: Jason | last post by:
I have two drop down lists on my asp.net page, the second of which needs to be filled in based on the selection in the first dropdownlist. The catch however, is that it must occur without a...
3
by: Carlos Lozano | last post by:
Hello, I am having a problem getting the selectedValue from a dropdownlist that is populated with a dataReader and just can't see the problem. I did the following: dim dr as DataReader dr...
11
by: Santosh | last post by:
Dear all , i am writting following code. if(Page.IsPostBack==false) { try { BindSectionDropDownlist();
3
by: =?Utf-8?B?ZGVuIDIwMDU=?= | last post by:
Hi, Trouble in retaining values of dropdownlist, textboxes, and other controls when dropdownlist selectedindexchanged event is triggered, the controls are inside a user control and this user...
11
by: harold.gimenez | last post by:
Hi group, I am trying to change the selection of an ASP Dropdownlist just like "Orange" is selected here: http://www.w3schools.com/js/tryit.asp?filename=try_dom_option_selected The...
3
by: Lohboy | last post by:
Using ASP.NET and IE7. (Sorry if I am posting in the wrong forum but my problem seemed to be more related to the JavaScript side than the ASP.NET side.) I have two DropDownList controls 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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.