Dropdown List and Modal Popup

Last post 02-08-2008 1:00 AM by nivedita_eligar. 7 replies.

Sort Posts:

  • Dropdown List and Modal Popup

    12-31-2007, 10:12 AM
    • Member
      657 point Member
    • conankingofcool
    • Member since 12-13-2007, 3:43 PM
    • Houston/Dallas, TX
    • Posts 141

    I have a drop down list that populates with different actions the user can take with a button they click to perform the action.  My problem is that one of the actions fires a modal popup on the page, but only after the page does a postback because of the button and the drop down list.  I would like for there to be no postback, but only for the action that involves the modal popup.  Can anyone help?

    Thanks.

    We're all in this together.
  • Re: Dropdown List and Modal Popup

    12-31-2007, 10:28 AM
    • Member
      482 point Member
    • sainathdk
    • Member since 12-18-2007, 8:21 PM
    • Pune, India
    • Posts 88

    Set the autopostback property of the control to false.

    Also, if you want to call a custom function, you can use the control.attributes.add("onchange","return javascript:FunctionNAme();")

    make sure you have a return false before the closing braces of the function, to ensure that postback does not happen. This is useful if you want to control the postback.

  • Re: Dropdown List and Modal Popup

    12-31-2007, 11:00 AM
    • Member
      657 point Member
    • conankingofcool
    • Member since 12-13-2007, 3:43 PM
    • Houston/Dallas, TX
    • Posts 141

    sainathdk:
    The autopostback value of my dropdownlist is already false, that is why I have a button the user can click when they are ready to perform the action.  The problem is that the button causes the postback and there is no autopostback property for a button.

     Thanks.

    We're all in this together.
  • Re: Dropdown List and Modal Popup

    12-31-2007, 11:39 AM
    Answer
    • Member
      482 point Member
    • sainathdk
    • Member since 12-18-2007, 8:21 PM
    • Pune, India
    • Posts 88
    Make sure you have a return false from the function that is being called on the click of the button. That will stop the postback

    function ButtonClick()
    {

    //your existing code goes here
    return false;

    }

    Button1.Attributes.Add("onclick", "javascript: return ButtonClick();")

     Hope this helps.

  • Re: Dropdown List and Modal Popup

    12-31-2007, 12:07 PM
    • Member
      657 point Member
    • conankingofcool
    • Member since 12-13-2007, 3:43 PM
    • Houston/Dallas, TX
    • Posts 141

    Ok, I understand what it is I am supposed to do.  I'm coding in visual basic.  I created the function and it returns false.  Now for the Button1.Attributes.Add(etc...) statement.  Do I put that in the page_load sub and instead of "javascript: return ButtonClick();", I say "BLOCKED SCRIPT return ButtonClick()" ?  I'm new to this and I'm not sure where to put this statement.  Thanks for your help.

    We're all in this together.
  • Re: Dropdown List and Modal Popup

    12-31-2007, 12:10 PM
    • Member
      657 point Member
    • conankingofcool
    • Member since 12-13-2007, 3:43 PM
    • Houston/Dallas, TX
    • Posts 141

    In my previous post where it says BLOCKED SCRIPT, it should say vb-script minus the -.

    We're all in this together.
  • Re: Dropdown List and Modal Popup

    12-31-2007, 12:55 PM
    • Member
      482 point Member
    • sainathdk
    • Member since 12-18-2007, 8:21 PM
    • Pune, India
    • Posts 88

    Yes the attributed.add statement will go in Page_load

    When you say coding in visual basic, that I assume is the code behind, i.e. .vb files. If you are ok using javascript for client side, then the code I gave you will work.

    For VBScript, if I find something I shall post it.

  • Re: Dropdown List and Modal Popup

    02-08-2008, 1:00 AM

    Hi Kelly,

    Can you please explain the solution in detail you found out?

    I am having ie 6 and facing a problem where in dropdowns in a page are not visible on popping out the modal popup panel. 

    Thanks

    Regards

    Nivedita

Page 1 of 1 (8 items)