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

Dropdown is not maintaining itz state after postback

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 selected item is the first one. This
happens even if i submitted the page by making the AutoPostback of the
dropdown true or by clicking on the submit button.
Even it’s 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 interesting matter is, this
problem comes only when i fill the dropdown from the database. if iam hard
coding 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
5 2081
"Deepson Thomas" <De***********@discussions.microsoft.com> wrote in message
news:C1**********************************@microsof t.com...
Anybody hav any idea what may be the problem


Move the code which populates the DropDown out of Page_Load and into
Page_Init
May 30 '06 #2
I hav a method which connects to DB and populates the dropdown. i changed the
calling of method from page load to page init as per ur suggestion but now
the data is not populating. If i move the calling back to page load then it
populates.
any idea what wrong with my code ?
--
Deepson Thomas
"Mark Rae" wrote:
"Deepson Thomas" <De***********@discussions.microsoft.com> wrote in message
news:C1**********************************@microsof t.com...
Anybody hav any idea what may be the problem


Move the code which populates the DropDown out of Page_Load and into
Page_Init

May 30 '06 #3
"Deepson Thomas" <De***********@discussions.microsoft.com> wrote in message
news:59**********************************@microsof t.com...
any idea what wrong with my code ?


Almost certainly because you haven't actually wired up Page_Init...

1) Open up the Web Form Designer generated code section

2) Open up the InitializeComponent method

3) Wire up the Page_Init method as well as the Page_Load method e.g.

this.Init += new System.EventHandler(this.Page_Init);
this.Load += new System.EventHandler(this.Page_Load);
May 30 '06 #4
Hi,
the this.Page_Load is wired up and OnInit method is there.
--
Deepson Thomas
"Mark Rae" wrote:
"Deepson Thomas" <De***********@discussions.microsoft.com> wrote in message
news:59**********************************@microsof t.com...
any idea what wrong with my code ?


Almost certainly because you haven't actually wired up Page_Init...

1) Open up the Web Form Designer generated code section

2) Open up the InitializeComponent method

3) Wire up the Page_Init method as well as the Page_Load method e.g.

this.Init += new System.EventHandler(this.Page_Init);
this.Load += new System.EventHandler(this.Page_Load);

May 31 '06 #5
"Deepson Thomas" <De***********@discussions.microsoft.com> wrote in message
news:FE**********************************@microsof t.com...
the this.Page_Load is wired up and OnInit method is there.


That's not what I actually said...
May 31 '06 #6

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...
1
by: Deepson Thomas | last post by:
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...
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.