473,385 Members | 1,535 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,385 software developers and data experts.

Dropdown is maintaining itz state after postback

Hi,
Currently iam facing a strange problem.. One dropdown in my page is
keeping itz state after postback. Whichever the item i selected is not the
selected item after postback. it goes back to the first item again. This
happens even if i submitted the page by making the AutoPostback of the
dropdown true or by clicking on the submit button. Even itz not going to the
DropDownList1_SelectedIndexChanged method.

A checking is already there at page load event to avoid filling the dropdown
at the time of postback.

The items are populating from database. The intresting matter is, this
problem comes only when i fill the dropdown from the database. if iam
hardcoding the items then this problem is not there. That time itz
maintaining the state.

Anybody hav any idea what may be the problem

--
Deepson Thomas
May 30 '06 #1
1 1428
It sounds like you're always repopulating the DropDownList in Page_Load (or
whereever you're accessing the database). Try to only populate the DropDownList
the first request in, so check !IsPostBack.

-Brock
http://staff.develop.com/ballen

Hi,
Currently iam facing a strange problem.. One dropdown in my page is
keeping itz state after postback. Whichever the item i selected is not
the
selected item after postback. it goes back to the first item again.
This happens even if i submitted the page by making the AutoPostback
of the dropdown true or by clicking on the submit button. Even itz not
going to the DropDownList1_SelectedIndexChanged method.

A checking is already there at page load event to avoid filling the
dropdown at the time of postback.

The items are populating from database. The intresting matter is, this
problem comes only when i fill the dropdown from the database. if iam
hardcoding the items then this problem is not there. That time itz
maintaining the state.

Anybody hav any idea what may be the problem

Jun 1 '06 #2

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

Similar topics

3
by: phil2phil | last post by:
hi, had a question on preloading a dropdown. we have a textbox and dropdown on the page, user is suppose to enter in a zip into textbox, then the dropdown should load the state based on the zip. ...
3
by: Lloyd Sheen | last post by:
I have a page that works fine. I am trying to optimize the page by overriding some of the Information that is being saved in the hidden VIEWSTATE. If I make the properties of the dropdown False...
1
by: Mad Scientist Jr | last post by:
I don't know how this is happening, but a dropdown control I have is resetting to the 2nd value on the list anytime a postback occurs. I have no initiation code outside of If Not (IsPostBack) ...
6
by: Mark | last post by:
I have two dropdown lists. Both have autopostback set to true. In both dropdowns, when you select an item from the list, it redirects to the Value property of the dropdown. Nothing fancy. ...
1
by: Ed Chiu | last post by:
Hi, I have 2 dropdown lists on an ASP.Net page, the first is a list of states of US, the second is City list. When user selects a state, the web page does a postback, create a DB connection and...
2
by: Pete Moss | last post by:
During a postback event, I am having trouble retrieving the state of a CheckBox Control that I am dynamically adding to a DataGrid Control using ASP.NET 1.1. I have no trouble adding the...
5
by: Deepson Thomas | last post by:
Hi, Currently iam facing a strange problem.. One dropdown in my page is not keeping itz state after postback. Whichever the item i select irrespective of that after the post-back the default...
1
by: clintonG | last post by:
I'm having a problem maintaining state with a Panel control in a MasterPage and I need help thinking through this process. The basic structure of the HTML in the Master looks like this... ...
0
by: mark.norgate | last post by:
Hi I'm having a problem in adding controls to a page programmatically in response to a button click. Composite user controls added programmatically in the CreateChildControls() method work...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.