DropDownList PostBack question

Last post 11-02-2007 12:56 PM by jjmonty. 6 replies.

Sort Posts:

  • DropDownList PostBack question

    11-01-2007, 12:14 PM
    • Loading...
    • sbrauen
    • Joined on 12-13-2006, 9:42 PM
    • Houston, TX
    • Posts 32

    I've got a DropDownList (DDL) that is set with AutoPostBack=true and is set with a SelectedIndexChanged event.  Everything works fine with regards to the post back, OnLoad fires, the SelectedIndex event fires, however that is it.

    In addition to this DDL I have a whole host of other controls that have DataBinding events that need to get fired on the post back, yet they aren't.  Is there something I'm missing, other than explicitly calling the DataBind command for all the extra controls, that will cause their DataBinding events to fire on a DDL post back?

    I'm hardly a noob, but this one has me stumped.  Any other method I use to post the form back will cause all of my controls to fire their DataBind events, except when I post back via this DDL.  Any ideas?

  • Re: DropDownList PostBack question

    11-01-2007, 12:32 PM
    • Loading...
    • natarajank
    • Joined on 11-01-2007, 4:23 PM
    • Posts 1

    In which event handler you are really binding the other controls? Is it in the page load event handler? If so can you post the code in that?

  • Re: DropDownList PostBack question

    11-01-2007, 12:32 PM
    • Loading...
    • jamesqua
    • Joined on 08-03-2004, 6:55 PM
    • Columbus, OH
    • Posts 1,150

    Why do your other controls need databinding when your drop down list changes?  Are they reseting to their page_load original values?

  • Re: DropDownList PostBack question

    11-01-2007, 12:50 PM

    can you post your code ..? 

    - Hardik (Software Developer,Surat,India)

    Please remember to click "Mark as Answer" on this post if it helped you.
  • Re: DropDownList PostBack question

    11-01-2007, 2:40 PM
    • Loading...
    • sbrauen
    • Joined on 12-13-2006, 9:42 PM
    • Houston, TX
    • Posts 32

    natarajank:

    In which event handler you are really binding the other controls? Is it in the page load event handler? If so can you post the code in that?

    • The other controls are being bound at the default time in the page life cycle, there are no special calls in Page_Load or any where else.

    jamesqua:

    Why do your other controls need databinding when your drop down list changes?  Are they reseting to their page_load original values?

    • Some of the other controls one the field have settings that are dependant upon other fields in the form, which in turn have settings that are dependant upon the current value of the DDL.  It's more convinient for me to do a whole bunch of independant DataBinding events on the individual controls then try and mess logical spaghetti in the DDL's DataBinding event.

    hardikpatel:

    can you post your code ..? 

    • You'll have to be more specfic in what code you want to look at.  The mark up and code behind run a couple thousand lines each and I'm sure you don't want to look at all that goo.
  • Re: DropDownList PostBack question

    11-02-2007, 11:09 AM
    Answer
    • Loading...
    • PeterBrunone
    • Joined on 06-19-2002, 9:15 AM
    • I'm standing behind you.
    • Posts 3,663
    • TrustedFriends-MVPs

    What is "the default time in the page life cycle"? 

    If you're not explicitly calling DataBind, then the controls will probably just retain their values from Viewstate.

    Peter Brunone
    MS MVP, ASP.NET
    Founder, EasyListBox.com
    Do the impossible, and go home early.
  • Re: DropDownList PostBack question

    11-02-2007, 12:56 PM
    • Loading...
    • jjmonty
    • Joined on 08-04-2007, 8:44 PM
    • Posts 69

    Are you calling Page.DataBind() from the SelectedIndexChanged handler or relying all the DataBind()s at the Control level?

Page 1 of 1 (7 items)
Microsoft Communities
Page view counter