This is a migrated thread and some comments may be shown as answers.

ValidatorCalloutExtender and RadNumericTextBox issue

11 Answers 177 Views
Input
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 30 Oct 2008, 05:16 AM
Hi, I hope someone can help me with the following issue - It seems like there is a problem with the javascript when using the RadNumericTextBox with a ValidatorCalloutExtender.

It seems like the problem is caused when page tries to dispose of the CalloutValidator.

To reproduce the issue, slap a simple webform together that looks something like this:
        <telerik:RadScriptManager runat="server" ID="rsm"></telerik:RadScriptManager> 
        <telerik:RadNumericTextBox ID="txtAmount" Runat="server"></telerik:RadNumericTextBox> 
        <asp:RangeValidator runat="server" id="rv1" MinimumValue=0 MaximumValue=1 ControlToValidate="txtAmount" ErrorMessage="Please fix"></asp:RangeValidator> 
        <ajaxControlToolkit:ValidatorCalloutExtender runat="Server" ID="vcerv1" TargetControlID="rv1" /> 
        <asp:Button runat="server" Text="Save" ID="btnSave"  /> 
        
Now, run it and enter an invalid value in the txtAmount textbox to get the CalloutExtender to pop up. Now press F5 - I get a "'_events' is null or not an object" javascript exception. Looking at the stack trace - this seems to stem from some cleanup method called by the browser on page unload. 

Am I doing something wrong, or is this a known issue - I had a look at the existing posts in the forum and couldn't find anything about this issue.

Thank you,
Peter

AjaxControlToolkit.dll : v3.0.20820.16598
Telerik.Web.UI.dll : v2008.2.1001.35

11 Answers, 1 is accepted

Sort by
0
Accepted
Missing User
answered on 03 Nov 2008, 01:26 PM
Hi Peter,

Indeed there is such issue with the current official version of RadNumericTextBox - we apologize for the inconvenience. You may be happy to know that the problem is addressed in the Q3 2008 which will be live on our site by the end of this week.


Regards,
Plamen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Peter
Top achievements
Rank 1
answered on 03 Nov 2008, 09:29 PM
Thank you, I'll be sure to download 2008 Q3 when it gets released.

Cheers,
Peter
0
towpse
Top achievements
Rank 2
answered on 02 Jun 2009, 06:54 PM
Guys. Hope someone can help.

I'm still seeing this issue but in a different spot. I get that same null a._events javascript error when I close my browser down.

I'm using an input manager with two input settings defined, both with initializeOnClient = true.
I'm finding if I take out the initializeOnClient attribute on one of my input settings I don't get the error.

I had some code that loads input controls into the manager but I commented out everything to do with the manager expect for the declaration in markup. I even removed all attributes eventually seeing that one initializeOnClient attribute in the manager was fine and having two caused that error.

The error is breaking in
MicrosoftAjax.js 

Right now I'm thinking of trying to declare two input managers with a single input setting each to see if that works.

Any thoughts?

Here's my InputManager markup, It's quite standard I would think.
      <%-- The following TextBox is required by the InputManager --%>  
    <asp:TextBox ID="TextBox1" runat="server"  style="display:none" />  
    <telerik:RadInputManager  ID="RadInputManager" runat="server" Skin="Vista"
        <telerik:NumericTextBoxSetting BehaviorID="NumericSettings" InitializeOnClient="true" Type="Number" DecimalDigits="1" GroupSizes="3" GroupSeparator="," PositivePattern="n" NegativePattern="-n">  
            <TargetControls> 
                <telerik:TargetInput ControlID="TextBox1" /> 
            </TargetControls> 
        </telerik:NumericTextBoxSetting> 
        <telerik:TextBoxSetting BehaviorID="TextSettings" InitializeOnClient="true"  > 
            <TargetControls> 
                <telerik:TargetInput ControlID="TextBox1" /> 
            </TargetControls> 
        </telerik:TextBoxSetting> 
    </telerik:RadInputManager> 


Update:
It may be that I use the same dummy text box for both input settings. If I use a different one, it seems to have solved the issue. I'm going to test some more. Let me know if that makes sense to you telerik folks. Thanks.



AjaxControlToolkit 3.0.20229.20843
Telerik.Web.UI 2008.3.1314.35
0
Pavel
Telerik team
answered on 05 Jun 2009, 05:54 AM
Hi Matt,

Can you try upgrading to the latest version of the controls (2009 Q1 527) and let us know if the problem persists. You can read more on how to upgrade in this Knowledge Base article.

Greetings,
Pavel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Thomas
Top achievements
Rank 1
answered on 22 Sep 2009, 01:49 PM

Pavel,

 

Can you guys add this functionality to RadTooltip so that we can use RadTooltips instead of CalloutExtenders?  It would be very excellent and a good enhancement to RadTooltip.

 

Thanks,

Tommy

0
Sebastian
Telerik team
answered on 22 Sep 2009, 02:09 PM
Hi Tommy,

How to integrate RadToolTip to display errors when the RadInput validation fails you can see from the sample available in this blog post on our site.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
lkj lkj
Top achievements
Rank 1
answered on 17 Feb 2010, 04:34 PM
Im on 2009 q3 and still have _events is null or not an object. Whenever the validatorCalloutExtender fires.. Are you planning to fix it?
0
Pavel
Telerik team
answered on 18 Feb 2010, 12:46 PM
Hello,

Can you provide more details about your scenario, as I cannot reproduce the error?

Sincerely yours,
Pavel
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Veli
Telerik team
answered on 15 Mar 2010, 02:35 PM
Hi guys,

This issue, as it turned out, is not related to RadInput controls or any of  the Telerik AJAX controls. The exception you are getting originates from a failing method in the ValidationCalloutExtender, and more specifically, from the PopupBehavior object that is used internally by the callout.

What happens is that PopupBehavior attaches event handlers to all the parent containers of the component's container element and tries to remove the event handlers when the object is disposed. The control does not, however, check if the event handlers have already been removed. As a result, if the handler that is tried to be removed is already gone (as happens when the element is a container of another script control, as components usually clear their container's event handlers themselves), you get the exception under discussion.

This issue can be observed using a very simple setup:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <asp:Panel runat="server" ID="pnlTest">
            <ajax:ValidatorCalloutExtender ID="vceFName" runat="server" Enabled="True" TargetControlID="rfvFName" />
            <asp:TextBox ID="txtFName" runat="server" />
            <asp:RequiredFieldValidator ID="rfvFName" runat="server" ControlToValidate="txtFName"
                Display="None" ErrorMessage="First Name is Required" SetFocusOnError="True" />
            <br />
            <asp:Button runat="server" ID="Button2" Text="Validate" />
            <asp:Button runat="server" ID="Button3" Text="Cancel" CausesValidation="false" OnClientClick="$get('form1')._events = null;" />
        </asp:Panel>
    </ContentTemplate>
</asp:UpdatePanel>


In the above markup, clicking the Cancel button will simulate the exception you are getting, as the _events object has been manually removed by the time the dispose method of the PopupBehavior is called.

To fix this issue, you will need to modify the dispose method of the PopupBehavior object from the AjaxControlToolkit to the following:

AjaxControlToolkit.PopupBehavior.prototype.dispose = function()
{
    /// <summary>
    /// Dispose the PopupBehavior
    /// </summary>
    var element = this.get_element();
    if (element)
    {
        if (this._visible)
        {
            this.hide();
        }
        if (this._originalParent)
        {
            element.parentNode.removeChild(element);
            this._originalParent.appendChild(element);
            this._originalParent = null;
        }
        // Remove expando properties
        element._hideWindowedElementsIFrame = null;
    }
    this._parentElement = null;
    // Remove the animation ended events and wipe the animations
    // (we don't need to dispose them because that will happen
    // automatically in our base dispose)
    if (this._onShow && this._onShow.get_animation() && this._onShowEndedHandler)
    {
        this._onShow.get_animation().remove_ended(this._onShowEndedHandler);
    }
    this._onShowEndedHandler = null;
    this._onShow = null;
    if (this._onHide && this._onHide.get_animation() && this._onHideEndedHandler)
    {
        this._onHide.get_animation().remove_ended(this._onHideEndedHandler);
    }
    this._onHideEndedHandler = null;
    this._onHide = null;
    if (this._onParentRepositionHandler != null)
    {
        $removeHandler(window, 'resize', this._onParentRepositionHandler);
    }
    if (this._elementsWithAttachedRepositionHandlers != null)
    {
        for (var i = 0; i < this._elementsWithAttachedRepositionHandlers.length; i++)
        {
            if (this._elementsWithAttachedRepositionHandlers[i]._event)
            {
                $removeHandler(this._elementsWithAttachedRepositionHandlers[i], 'resize', this._onParentRepositionHandler);
                $removeHandler(this._elementsWithAttachedRepositionHandlers[i], 'scroll', this._onParentRepositionHandler);
            }
        }
        this._elementsWithAttachedRepositionHandlers = null;
    }
    this._onParentRepositionHandler = null;
    AjaxControlToolkit.PopupBehavior.callBaseMethod(this, 'dispose');
}


Above is the overriden dispose method of the PopupBehavior, where a check has been included (the marked if statement) before removing the event handlers. You need to either modify the debug and release versions of PopupBehavior.js from the control toolkit project and rebuild the toolkit from source, or use this script in every page you use callout extenders and any kind of popups from the AJAX toolkit.


Best,
Veli
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Deepak Saboji
Top achievements
Rank 1
answered on 01 Sep 2010, 02:59 PM
Hello,
I am also facing the same problem of  "_events is null or not an object".
The scenario is -  i am having a modelpopupextender . On that i am having a button to search some records and option to save and cancel.
I click the search button and then after performing some operations click cancel or save  button , the popup hides and the appropriate action takes place.
but when i refresh the page or click the save button on parent page ,  this error occurs.
The error comes only in a scenario when i click search button.
otherwise the application works fine.
i was reading the solution given above but how will it be possible for me to change the ajaxcontroltoolkit function?
can you people suggest some ideas for it?
is it possible to write something in my code to achieve the same?



Yours sincerely,

Thanks and regards
0
Dimo
Telerik team
answered on 01 Sep 2010, 03:52 PM
Hello Deepak,

A Javascript function from any library (such as the AjaxControlToolkit) can be overridden if you redefine a different function with the same name after the original function has been parsed. In other words, if you paste the Javascript code in the <body> of the page, you will override the toolkit scripts. You need to include or register the code in the <body> in order to ensure that it is parsed after the original code, which is inside the <head>.

Regards,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Input
Asked by
Peter
Top achievements
Rank 1
Answers by
Missing User
Peter
Top achievements
Rank 1
towpse
Top achievements
Rank 2
Pavel
Telerik team
Thomas
Top achievements
Rank 1
Sebastian
Telerik team
lkj lkj
Top achievements
Rank 1
Veli
Telerik team
Deepak Saboji
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or