I am trying to get a modal popup to display on an onblur event, but I keep getting a "'null' or is null or not an object" js error.

I have seen many examples using

var _popup;
        _popup = $find('MPE');
        _popup._show();
//And
$find('MPE')._show();
//And
$object('MPE')._show()

But none of them work. I just need to fire the Modal Popup on the client side...

Code for the Modal Popup:

<cc1:ModalPopupExtender ID="MPE" runat="server"
    TargetControlID="TestButton"
    PopupControlID="pnlWeightMessage"
    BackgroundCssClass="modalBackground" 
    DropShadow="true" 
    OkControlID="BacktoForm"
/>

Thanks...

Posting the server side code is pointless since browser embedded Javascript works with / operates on the generated content. Plus with no definitions of functions like $find(), $object(), show() how do you expect us to help you out? Maybe this question would be more suited in the C# / ASP .NET forums considering considering that you are making use of custom components.

I am using components from the Ajax toolkit from the asp.net site... $find(), $object(), show() are used with javascript to find controls on the page. The C# was actually just a control placed on the .aspx page, my bad on that. Sorry, I did not think it would be a stretch for someone in the AJAX/Javascript area to know how to work with something like this.

Regardless, I figured it out.

Here is the info if anyone else has the same issue:

<cc1:ModalPopupExtender ID="MPE" runat="server"
            TargetControlID="TestButton"
            PopupControlID="pnlWeightMessage"
            BackgroundCssClass="modalBackground" 
            DropShadow="true" 
            OkControlID="BacktoForm"
            BehaviorID="MPE" <!-- Added behavior to the control and named it the same as the ID-->
        />
//Once I added the behavior this
$find('MPE').show();
//worked to call the Modal Popup from the javascript function
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.