Javascript Error in Upload Avatar Example

6 posts, 0 answers
  1. Dean
    Dean avatar
    17 posts
    Member since:
    Jan 2008

    Posted 03 Oct 2011 Link to this post

    I created a page that uses the "Upload Avatar" example exactly, and when I run it in IE 9 I get the following error:

    "Unable to get value of the property 'ajaxRequest': object is null or undefined"

    Has anyone seen this?

    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
    </telerik:RadScriptManager
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Thumbnail" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <script type="text/javascript">
        function fileUploaded(sender, args) {
            $find('RadAjaxManager1').ajaxRequest();
            $telerik.$(".invalid").html("");
            setTimeout(function() {
                sender.deleteFileInputAt(0);
            }, 10);
        }
     
        function validationFailed(sender, args) {
            $telerik.$(".invalid")
                .html("Invalid extension, please choose an image file");
            sender.deleteFileInputAt(0);
        }
    </script
     
     
                <telerik:RadBinaryImage runat="server" Width="200px" Height="150px" ResizeMode="Fit"
                    ID="Thumbnail" ImageUrl="blank.png" AlternateText="Thumbnail" CssClass="binary-image" />
     
     
                <span class="invalid"></span>
                <telerik:RadAsyncUpload runat="server" ID="AsyncUpload1" MaxFileInputsCount="1" OnClientFileUploaded="fileUploaded"
                    OnFileUploaded="AsyncUpload1_FileUploaded" AllowedFileExtensions="jpeg,jpg,gif,png,bmp" OnClientValidationFailed="validationFailed">
                    <Localization Select="Upload Logo" />
                </telerik:RadAsyncUpload>
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 04 Oct 2011 Link to this post

    Hello Dean,

    I am not sure which version of the Telerik controls that you are using. IE 9, FireFox 4 and Google Chrome10 are supported by controls starting Q1 2011. If you would like to ensure that our AJAX controls are compatible with the new major versions of these three browsers, you will need to migrate at least to version 2011.1.315. With older versions these browsers are only partially supported.

    Updating RadControls for ASP.NET AJAX to another version or license.

    Thanks,
    Shinu.
  3. Dean
    Dean avatar
    17 posts
    Member since:
    Jan 2008

    Posted 04 Oct 2011 Link to this post

    I verified that we are using the latest version.
  4. Dean
    Dean avatar
    17 posts
    Member since:
    Jan 2008

    Posted 04 Oct 2011 Link to this post

    FYI,

    It seems like it may only be an issue when running in debug mode.  If I run the page from with Visual Studio, I get the error when I select a file to upload.  But if I copy the URL and paste it into another browser window (IE or Chrome), it seems to work.  I'll see if I can get the project compiled and put on a web server and run some tests.
  5. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 06 Oct 2011 Link to this post

    Hello Dean,

    The code that you are using seems fine, so test it when deployed and let me know of the results.

    Best wishes,
    Dimitar Terziev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  6. Suwitcha
    Suwitcha avatar
    1 posts
    Member since:
    Jun 2012

    Posted 26 Feb 2012 Link to this post

    I think you may have met this problem when you put your code in a Master page. So that the $find() can't find the RadAjaxManager control, then the result of calling the method is 'object is null or undefined'

    try this $find('<%= RadAjaxManager1.ClientID %>').ajaxRequest(); and you may succeed. :)

Back to Top