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

ImageUploader JS Errors

1 Answer 55 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Daniel Bright
Top achievements
Rank 1
Daniel Bright asked on 01 Jul 2011, 03:35 AM
I am getting this error (image attached) when I open the ImageManagers upload screen:

Sys.ArgumentOutOfRangeException:
Value must be an integer.
Parameter name: y Actual value was -2.383331298828125.

I'm using the latest Version (as of time of reply): 2011.1 519 (May 19, 2011).

The error happens when the uploader dialog section is open and when I mouse over the upload textbox and back into the white space underneath it.

Here is my code for the front end:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CustomCertificateEdit.aspx.cs"
    Inherits="Web.Admin.CustomCertificateEdit" MasterPageFile="~/Core/DefaultMasterPage.master" %>
  
<%@ MasterType VirtualPath="~/Core/DefaultMasterPage.master" %>
<%@ Import Namespace="Telerik.Web.UI" %>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="headPlaceHolder">
    <style type="text/css">
        .radeditorContainer
        {
            margin-left: auto;
            margin-right: auto;
            width: 610px;
        }
        .customCertContentContainer
        {
            margin-left: auto;
            margin-right: auto;
            width: 850px;
        }
        .radEditorErrorColumn
        {
            vertical-align: bottom;
        }
        .reTool .ImportField
        {
            background-image: url(<%= ResolveUrl("~/images/icon_popup_search.gif") %>);
        }
    </style>
    <script type="text/javascript" language="javascript">
  
  
        function radEditor_ClientCommand(editor, args) {
            if (args.get_commandName() == "ImageManager") {
                var callback = function (sender, args) {
                    var result = args.get_value();
                    $get("hdnImagesUploaded").value += (result.src + ",");
                    editor.pasteHtml(result, "ImageManager");
                };
                args.set_callbackFunction(callback);
            }
        }     
  
    </script>
</asp:Content>
<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
    <asp:HiddenField ID="hdnImagesUploaded" runat="server" />
    <cs:CsPanel runat="server" ID="pnlCertificates" Title="Custom Certificate Advanced Editor"
        DoLocalize="true">
        <br />
        <br />
        <div class="customCertContentContainer">
            <div class="radeditorContainer">
                <span class="FieldName">
                    <%= "Certificate Title:".Localize() %></span>
                <asp:TextBox ID="txtTitle" runat="server" MaxLength="300" CssClass="FieldValue" Style="width: 300px;" />
                <asp:RequiredFieldValidator ID="reqvTitle" ControlToValidate="txtTitle" runat="server"
                    Text="*" /><br />
                <br />
                <div style="float: left;">
                    <cs:CsodRadEditor ID="radeditorCntrl" runat="server" EditorStyle="Advanced" Width="595"
                        EnableHtmlEdit="true" EnableResize="false" AllowScripts="false" Skin="Windows7" ExternalDialogsPath="~/Core/Telerik" />
                </div>
                <div class="radEditorErrorColumn">
                    <asp:RequiredFieldValidator ID="reqvRadEditor" ControlToValidate="radeditorCntrl"
                        runat="server" Text="*" />
                </div>
                <div style="clear: both;">
                </div>
                <br />
                <br />
                <cs:CsImageButton ID="btnSave" runat="server" TemplateName="done" OnClick="btnSave_Click" />
                   
                <cs:CsImageButton ID="btnCancel" runat="server" TemplateName="cancel" OnClick="btnCancel_Click" />
            </div>
        </div>
    </cs:CsPanel>
    <script language="javascript">
  
        Telerik.Web.UI.Editor.CommandList["ImportField"] = function (commandName, editor, args) {
            //window.popupCaller = 'textbox';
              alert('import field');
        };
  
    </script>
</asp:Content>

Here is the pertinent (only part I reference the radeditor) code in my code behind:

protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                this.Title = "Advanced Certificate Page Editor".Localize();
                this.breadCrumbs.Reload("");
                if (!isNew)
                {
                    CertificateEntityModel model = this.PullCertificateFromId(certificateId.Value); 
                    if (model != null)
                    {
                        txtTitle.Text = model.Title;
                        radeditorCntrl.Content = model.Html;
                    }
                }
  
                //add the custom import field button
                EditorTool importFieldTool = new EditorTool("Import Field", string.Empty);
                importFieldTool.Name = "ImportField";
                importFieldTool.Text = "Import Field".Localize();
                radeditorCntrl.Tools[1].Tools.Add(importFieldTool);
  
                //setup the image manager's filepaths and maxfile size
                string[] webPath = new string[] { Functions.GetPublicClientCustomCertificatesUploadPath(CorpName) };
                radeditorCntrl.ImageManager.ViewPaths = webPath;
                radeditorCntrl.ImageManager.UploadPaths = webPath;
                radeditorCntrl.ImageManager.DeletePaths = webPath;
                radeditorCntrl.ImageManager.MaxUploadFileSize = ONE_MEG;
                radeditorCntrl.OnClientCommandExecuted = "radEditor_ClientCommand";
            }
        }

One more thing to note; I had an issue with the image uploader throwing a server error of "expression expected". That was fixed when I added "EnableLinqExpressions = false" in a custom dialog control. In fact, it is the same code/methodology as the link http://www.telerik.com/support/kb/aspnet-ajax/editor/displaying-single-upload-control-in-the-filebrowser-upload-manager.aspx with only that one property changed.

I see people are having the same problem in this thread http://www.telerik.com/community/forums/reply-thread.aspx?messageId=0&threadId=263910 however it is a somewhat old thread in which case the version of Telerik being used is older than mine and I was therefore prompted to start a new thread about the issue.

Any idea on how we can solve this?

1 Answer, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 06 Jul 2011, 08:11 AM
Hi Daniel,

I tried to reproduce this problem but to no avail. The provided code snippet looks OK but it is not runnable due to the missing user control code. To be able to determine the reason for this problem we will need to examine and debug the problematic code locally. Could you please open a formal support ticket and provide a fully runnable sample project reproducing the problem?

Greetings,
Dobromir
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Editor
Asked by
Daniel Bright
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Share this question
or