Popup Extender - triggering problems

Last post 08-06-2008 4:26 PM by sashee. 6 replies.

Sort Posts:

  • Popup Extender - triggering problems

    07-31-2008, 4:52 PM
    • Member
      20 point Member
    • sashee
    • Member since 07-31-2008, 4:40 PM
    • Posts 40

    Hi:

    My problem might have been addressed earlier already through one of the posts but somehow I was unable to find that.

    I am using PopupExtender control on my page. I have a text box and an image side by side. I want to open the popup after clicking the image and once I made a selection on the popup, the returned valus should be placed in the textbox. Any quick help is appreciated much. Thanks.

     Regards,

    Shashi

  • Re: Popup Extender - triggering problems

    07-31-2008, 7:27 PM

    give your popupcontrolextender a behaviorID 

    add some javascript to your image for the onclick='ShowPopup()'

    add the javascript function

    function ShowPopup()
    {
    var behavior = $find('YourPopupBehaviorID');
    behavior.showPopup();
    }

    Then you can do the reverse for hiding the popupcontrol
  • Re: Popup Extender - triggering problems

    08-01-2008, 9:53 AM
    • Member
      20 point Member
    • sashee
    • Member since 07-31-2008, 4:40 PM
    • Posts 40

    Hi:

    Thanks for the reply but I understood very little. Could you please elaborate?

    You gotta excuse my dumb questions but I am confused with this behaviorID and TargetControlID. Do I need to set both? and also I couldnt understand the line 'behavior.showPopup()'. Is this another custom js function? If so whats the purpose? something like window.open()...??

    Lastly as you mentioned I need to write my own function to hide the popup? I mean can't I use  the popupcontrolextender.Cancel() method? Please extend your help. Thanks.

     Regards,

    Shashi

  • Re: Popup Extender - triggering problems

    08-01-2008, 12:00 PM
    Answer

    No problem,

    The behaviorID is like a secondary ID to the control.  It is used by the $find function to locate the control, in this case your popupcontrolextender.  So add a behaviorID to your popupcontrolextender, you can name it anything, for example ShashisPopup.  The targetcontrolID is the ID of the control that the extender will be working with.  In this you could make it the ID of the image.

    <cc1:PopupControlExtender ID="PopupControlExtender1" runat="server" PopupControlID="pnlShashisPanel" BehaviorID="ShashisPopup" TargetControlID="imgArrow" >

    Then when you do the $find('ShashisPopup'), you will get a reference to your popupcontrolextender.  The popupcontrolextender exposes the showPopup() method.  So by calling the showPopup() method on your reference that you found using the behaviorID you will be causing the popup to become visible.

    Eg -
    function ShowMyPopup() {
       var behaviorID = $find('ShashisPopup');
       behaviorID.showPopup();
    }

    And by wiring the javascript function to the onclick event of the image, the javascript will execute and your popup will become visible when your image is clicked.

    Eg-
    <img id="imgArrow" src="../Images/Arrow.gif" runat="server" onclick="ShowMyPopup()" />


    Hope this helps,

    Brent

  • Re: Popup Extender - triggering problems

    08-01-2008, 12:56 PM
    • Member
      20 point Member
    • sashee
    • Member since 07-31-2008, 4:40 PM
    • Posts 40

    Yes; it helped me certainly; and I thank you for that.

    I am copy pasting my another question, relates to popupcontroller, from another thread here since i am sure you have an answer for that too. Please read below:

    ********************

    I am making use of the popupcontrolextendar on an image button click; I mean the TragetControlID for the extendar is an image button. Say my popup is a calendar and after selecting the date I want it to be displayed in another textbox.

    Is there anyway that I can make use of the existing extendar's method, Commit()?
    I mean PopupControlExtender1.Commit(Calendar1.SelectedDate.ToShortDateString()); To my knowledge it only refers to the  TargetcontrolID. Right?

    I tried few things in Calendar_SelectionChanged() event handler, like writing the selected date to the textbox but didnt work out as the calendar is inside ajax updatepanel and the textbox is not.

    Can someone help me out plz?

    ********************

    Regards,

    ~sashee

  • Re: Popup Extender - triggering problems

    08-01-2008, 2:21 PM
    Answer

    Oh, well if thats what you are wanting to do then try this method, and forget about the popupcontrolextender.  I already posted it it here http://forums.asp.net/t/1269377.aspx

    Let me know if this is good for you.

    Regards,

    Brent

  • Re: Popup Extender - triggering problems

    08-06-2008, 4:26 PM
    • Member
      20 point Member
    • sashee
    • Member since 07-31-2008, 4:40 PM
    • Posts 40

    Hi:

    We are planning to replace all popup controls in our project with the ajax one, popupcontrolextendar. But when I referred to the sample website I found example that opens the popup upon mouseclick; I dont want that.

    Instead when I click an image sits near to  the text box, the popup should open. Not only that the return value from the popup should right be placed in the textbox followed by popup closing.

    This is all I want. Could you help me in that? Thanks.

    ~sashee

Page 1 of 1 (7 items)