Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Dropdown is not maintaining itz state after postback

Reply
Thread Tools

Dropdown is not maintaining itz state after postback

 
 
=?Utf-8?B?RGVlcHNvbiBUaG9tYXM=?=
Guest
Posts: n/a
 
      05-30-2006
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
 
Reply With Quote
 
 
 
 
Mark Rae
Guest
Posts: n/a
 
      05-30-2006
"Deepson Thomas" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> Anybody hav any idea what may be the problem


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


 
Reply With Quote
 
 
 
 
=?Utf-8?B?RGVlcHNvbiBUaG9tYXM=?=
Guest
Posts: n/a
 
      05-30-2006
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
> > Anybody hav any idea what may be the problem

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

 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      05-30-2006
"Deepson Thomas" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> 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);


 
Reply With Quote
 
=?Utf-8?B?RGVlcHNvbiBUaG9tYXM=?=
Guest
Posts: n/a
 
      05-31-2006
Hi,
the this.Page_Load is wired up and OnInit method is there.
--
Deepson Thomas


"Mark Rae" wrote:

> "Deepson Thomas" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
> > 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);
>
>
>

 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      05-31-2006
"Deepson Thomas" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> the this.Page_Load is wired up and OnInit method is there.


That's not what I actually said...


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C Ebooks, Itz my effort consultant C Programming 3 05-03-2007 11:48 AM
Dropdown is maintaining itz state after postback =?Utf-8?B?RGVlcHNvbiBUaG9tYXM=?= ASP .Net 1 06-01-2006 02:58 PM
Postback not working, Pages not maintaining state Tom wilson ASP .Net 2 02-14-2005 06:00 PM
Postback not working, pages not maintaining state - I entirely don't get it. Tom wilson ASP .Net 2 02-11-2005 08:13 PM
XML control not maintaining contents after postback, even with EnableViewState=true Justin Crossley ASP .Net 0 11-08-2004 03:18 PM



Advertisments