Dropdown is not maintaining itz state after postback

Discussion in 'ASP .Net' started by =?Utf-8?B?RGVlcHNvbiBUaG9tYXM=?=, May 30, 2006.

  1. 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
     
    =?Utf-8?B?RGVlcHNvbiBUaG9tYXM=?=, May 30, 2006
    #1
    1. Advertising

  2. =?Utf-8?B?RGVlcHNvbiBUaG9tYXM=?=

    Mark Rae Guest

    "Deepson Thomas" <> wrote in message
    news:...

    > Anybody hav any idea what may be the problem


    Move the code which populates the DropDown out of Page_Load and into
    Page_Init
     
    Mark Rae, May 30, 2006
    #2
    1. Advertising

  3. 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" <> wrote in message
    > news:...
    >
    > > Anybody hav any idea what may be the problem

    >
    > Move the code which populates the DropDown out of Page_Load and into
    > Page_Init
    >
    >
    >
     
    =?Utf-8?B?RGVlcHNvbiBUaG9tYXM=?=, May 30, 2006
    #3
  4. =?Utf-8?B?RGVlcHNvbiBUaG9tYXM=?=

    Mark Rae Guest

    "Deepson Thomas" <> wrote in message
    news:...

    > 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);
     
    Mark Rae, May 30, 2006
    #4
  5. Hi,
    the this.Page_Load is wired up and OnInit method is there.
    --
    Deepson Thomas


    "Mark Rae" wrote:

    > "Deepson Thomas" <> wrote in message
    > news:...
    >
    > > 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);
    >
    >
    >
     
    =?Utf-8?B?RGVlcHNvbiBUaG9tYXM=?=, May 31, 2006
    #5
  6. =?Utf-8?B?RGVlcHNvbiBUaG9tYXM=?=

    Mark Rae Guest

    "Deepson Thomas" <> wrote in message
    news:...

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


    That's not what I actually said...
     
    Mark Rae, May 31, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Justin Crossley
    Replies:
    0
    Views:
    433
    Justin Crossley
    Nov 8, 2004
  2. Tom wilson
    Replies:
    2
    Views:
    2,642
    Tom wilson
    Feb 11, 2005
  3. Tom wilson
    Replies:
    2
    Views:
    576
    Tom wilson
    Feb 14, 2005
  4. =?Utf-8?B?RGVlcHNvbiBUaG9tYXM=?=

    Dropdown is maintaining itz state after postback

    =?Utf-8?B?RGVlcHNvbiBUaG9tYXM=?=, May 30, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    480
    Brock Allen
    Jun 1, 2006
  5. consultant

    C Ebooks, Itz my effort

    consultant, May 2, 2007, in forum: C Programming
    Replies:
    3
    Views:
    370
Loading...

Share This Page