locked
Null Reference for PopupControlExtender RRS feed

  • Question

  • User767580559 posted

    Hello,

    I am attempting to a web page as a popup via Ajax PopupControlExtender but having some difficulty. When attempting to show the popup, the following error is returned:

    "JavaScript runtime error: Unable to get property 'showPopup' of undefined or null reference"

    I've tried to access the control by way of the BehaviorID, ClientID and ControlBehavior (I.e. AjaxControlToolkit.PopupControlBehavior.__VisiblePopup.showPopup(); )

    but to no avail. There are a few odd things occurring that maybe worth mentioning:

    1.  I am able to show a non-modal popup with Ajax PopupControlExtender in other pages using the BehaviorID

    2. I am able to show a Modal popup (I.e. ModalPopupExtender) from the page in question with no problem.

    3. Other controls in the page can be accessed with ClientID. It's just the PopupControlExtender control whereby the null reference is returned.

    Here's a sample of the code:

    <cc1:PopupControlExtender ID="test1_PopupControlExtender" 
            runat="server" DynamicServicePath="" Enabled="True" ExtenderControlID="" 
            TargetControlID="Label1" PopupControlID="test1">
        </cc1:PopupControlExtender>
    
    
         $find('test1').showPopup();
        //AjaxControlToolkit.PopupControlBehavior.__VisiblePopup.showPopup();
        //$find('<%=form1.FindControl("test1_PopupControlExtender").ClientID%>').showPopup();   
        
        

    Any help is appreciated.

    Friday, July 25, 2014 7:23 PM

Answers

  • User767580559 posted

    Hi Kevin,

    Thanks for the reply. It's appreciated. I've been able to show the PopupControlExtender from other web pages. Here's a sample of one from the Master page:

    --Javascript
    function showPopupWindow(sUrl, iWidth, iHeight) 
        {        
            var frame = document.getElementById('<%=frmMaster.FindControl("IFrameNonModal").ClientID%>');
            var panel = document.getElementById('<%=frmMaster.FindControl("PanelNonModal").ClientID%>');
            
                    
            frame.src = sUrl;
            frame.width = iWidth;
            frame.height = iHeight;
            panel.Width = iWidth;
            panel.Height = iHeight;
    
            $find('NonModalPopup').showPopup();               
        }
        
    
    --HTML
    <cc1:PopupControlExtender ID="test_PopupControlExtender" 
            runat="server" BehaviorID="NonModalPopup" DynamicServicePath="" Enabled="True" 
            ExtenderControlID="" TargetControlID="AccessKeyPanel" 
            PopupControlID="PanelNonModal" OffsetX="-1" OffsetY="-1">
        </cc1:PopupControlExtender>
        <asp:Panel ID="PanelNonModal" runat="server" CssClass="NonModalPopup" 
            style="display:none;">
            <div class="header" runat="server" id="divMasterPageTitleBar">            
             TBD   
             <a onclick="AjaxControlToolkit.PopupControlBehavior.__VisiblePopup.hidePopup(); return false;" title="Close" class="closeDialog" id="ALink_NonModal">X</a>
            </div>
            <iframe id="IFrameNonModal" src="" runat="server"></iframe>
            <div class="footer" style="display:none">
                <input id="btnOk_nonModal" type="button" value="Done" />
                <input id="btnCancel_nonModal" type="button" value="Cancel" />
            </div>
        </asp:Panel>
    

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 28, 2014 12:41 PM

All replies

  • User-1360095595 posted

    You tried using behaviorid... Try again. Give the extender a behaviorid="popup1". Then use $find('popup1').showPopup().

    Saturday, July 26, 2014 1:01 AM
  • User767580559 posted

    Hi,

    Thanks for the reply. My apologies for the typo in the code. Instead of "test1", it should be panel1. As mentioned in the original post, both the BehaviorID and ClientID has been tried as well as ControlBehavior.

    Saturday, July 26, 2014 1:52 AM
  • User1918509225 posted

    Hi wraooingduke,

    I have tried with behaviorID and ClientID,it  seems that you can not use jquery to hide or show the PopupControlExtender.

    I suggest that you can try to useModalPopupExtender,which can use jquery to hide or show it.

    Best Regards,

    Kevin Shen.

    Monday, July 28, 2014 4:46 AM
  • User767580559 posted

    Hi Kevin,

    Thanks for the reply. It's appreciated. I've been able to show the PopupControlExtender from other web pages. Here's a sample of one from the Master page:

    --Javascript
    function showPopupWindow(sUrl, iWidth, iHeight) 
        {        
            var frame = document.getElementById('<%=frmMaster.FindControl("IFrameNonModal").ClientID%>');
            var panel = document.getElementById('<%=frmMaster.FindControl("PanelNonModal").ClientID%>');
            
                    
            frame.src = sUrl;
            frame.width = iWidth;
            frame.height = iHeight;
            panel.Width = iWidth;
            panel.Height = iHeight;
    
            $find('NonModalPopup').showPopup();               
        }
        
    
    --HTML
    <cc1:PopupControlExtender ID="test_PopupControlExtender" 
            runat="server" BehaviorID="NonModalPopup" DynamicServicePath="" Enabled="True" 
            ExtenderControlID="" TargetControlID="AccessKeyPanel" 
            PopupControlID="PanelNonModal" OffsetX="-1" OffsetY="-1">
        </cc1:PopupControlExtender>
        <asp:Panel ID="PanelNonModal" runat="server" CssClass="NonModalPopup" 
            style="display:none;">
            <div class="header" runat="server" id="divMasterPageTitleBar">            
             TBD   
             <a onclick="AjaxControlToolkit.PopupControlBehavior.__VisiblePopup.hidePopup(); return false;" title="Close" class="closeDialog" id="ALink_NonModal">X</a>
            </div>
            <iframe id="IFrameNonModal" src="" runat="server"></iframe>
            <div class="footer" style="display:none">
                <input id="btnOk_nonModal" type="button" value="Done" />
                <input id="btnCancel_nonModal" type="button" value="Cancel" />
            </div>
        </asp:Panel>
    

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 28, 2014 12:41 PM