Dropdown within ModalPopup

Last post 07-27-2007 7:51 PM by deblendewim. 3 replies.

Sort Posts:

  • Dropdown within ModalPopup

    07-26-2007, 1:52 PM
    • Loading...
    • duditz
    • Joined on 11-19-2006, 6:40 AM
    • Posts 15

    I have a dropdownlist within an updatepanel inside a  modal popup extender that is popuplated with an object data source which uses a session variable as a parameter.

    When i click on a button within this update panel, the selected item of the dropdownlist is used in code. The problem is that the selecteditem seen in the button's code behind trace is not the same as what is selected on the screen. EnableViewState is set to true on the control... I cannot figure this one out.

     

  • Re: Dropdown within ModalPopup

    07-26-2007, 5:54 PM
    • Loading...
    • deblendewim
    • Joined on 12-20-2006, 4:32 PM
    • Antwerp, Belgium
    • Posts 948

    Hi,

    Since the new value of the ddl is not yet posted back to the server, in the code behind, the server doesn't know the newly selected value on the client-side.

    What you can do is set the AutoPostBack property of the ddl to true. This will make it postback the newly selected value to the server when the index is changed. Ok, normally you would have a full page refresh, but since the dll is on an updatepanel, only the panel gets refreshed.

    You should keep in mind that, when the ddl value is changed, and the button in clicked very fast after the ddl-value-change, then on the server-side it is possible that you still work with the old value. That's why you should also do some sort of button disabling when the updatepanel gets refreshed.

    Hope this helps!
    Wim

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
  • Re: Dropdown within ModalPopup

    07-26-2007, 7:03 PM
    • Loading...
    • duditz
    • Joined on 11-19-2006, 6:40 AM
    • Posts 15

    Yes, initially I had thought the same, but when the dropdown has autopostback = true, the objectdatasource refreshes and resets the selected item even though enableviewstate = true

  • Re: Dropdown within ModalPopup

    07-27-2007, 7:51 PM
    • Loading...
    • deblendewim
    • Joined on 12-20-2006, 4:32 PM
    • Antwerp, Belgium
    • Posts 948

    Hi,

    Can you post the page's code? Possibly stripped so only the problem is shown?

    Maybe then we can see what's going wrong.

     

    Regards,
    Wim

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Page 1 of 1 (4 items)
Microsoft Communities
Page view counter