Setting ModalPopupExtender Target Control ID

Last post 10-31-2007 6:52 PM by Jason Hill. 1 replies.

Sort Posts:

  • Setting ModalPopupExtender Target Control ID

    10-31-2007, 5:08 PM
    • Member
      80 point Member
    • haribo85
    • Member since 12-13-2006, 8:44 PM
    • Posts 248

    Hi,

    In my code I am wanting to assign the value of the ModalPopupExtender TargetControlID to a link button which is not in the same updatePanel.

    What I have is a Case statement in my backend, and when the value is selected in the GridView using a LinkButton I set a session variable using the datakey, like:
    Session("Session1") = GridView1.DataKeys(CInt(e.CommandArgument)).Value

    What I want to do though is use that LinkButton to open up a ModalPopup box and then use the Variable in there, but I am getting the error:
    The TargetControlID of 'ModalPopupExtender2' is not valid. A control with ID 'LinkButton2' could not be found.

    Is there anyway I can get around this? I think it is because the Link button is not in the same update panel.

    Thanks

     

  • Re: Setting ModalPopupExtender Target Control ID

    10-31-2007, 6:52 PM
    Answer
    • Contributor
      2,019 point Contributor
    • Jason Hill
    • Member since 04-22-2006, 11:39 PM
    • Sydney, Australia
    • Posts 479

    A better approach might be to use a hidden linkbutton as the targetcontrol of the modalpopup (style="display:none;") and then control the displaying of the modalpopup in code by calling show(). This means that you can then open the modalpopup from any control on the page regardless of the updatepanel.

Page 1 of 1 (2 items)