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

Image Browser showing undefined from inline editing context

4 Answers 292 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 29 Sep 2013, 05:49 PM
When I launch the image browser from an Editor the image seems to load up properly, however when I launch the image browser from "Inline Editing" all I get is a list of undefined objects.

I am using version 2013.2.918. Here is the code I am using to instantiate the editors:

Inline Editing Version:
$(document).ready(function () {
    $(".rich-text").kendoEditor({
        encoded: false,
        tools: [
            "bold",
            "italic",
            "underline",
            "insertImage"
        ],
        imageBrowser: {
            path: "/",
            transport: {
                read: "/cms/imagebrowser/read",
                destroy: "/cms/imagebrowser/destroy",
                create: "/cms/imagebrowser/create",
                thumbnailUrl: "/cms/imagebrowser/thumbnail",
                uploadUrl: "/cms/imagebrowser/upload",
                imageUrl: "/content/cms/images/{0}"
            }
        }
    });
});
Editor Version in my CMS:
@model string
 
@(Html.Kendo().EditorFor(m => m)
    .Encode(false)
    .Tools(tools => tools
          .Clear()
          .Bold().Italic().Underline().Strikethrough()
          .JustifyLeft().JustifyCenter().JustifyRight().JustifyFull()
          .InsertUnorderedList().InsertOrderedList()
          .Outdent().Indent()
          .CreateLink().Unlink()
          .InsertImage()
          .SubScript()
          .SuperScript()
          .TableEditing()
          .ViewHtml()
          .Formatting()
          .FontName()
          .FontSize()
          .FontColor().BackColor()
    )
    .ImageBrowser(imageBrowser => imageBrowser
        .Image("~/content/cms/images/{0}")
        .Read("read", "imagebrowser", new { Area = "cms" })
        .Create("create", "imagebrowser", new { Area = "cms" })
        .Destroy("destroy", "imagebrowser", new { Area = "cms" })
        .Upload("upload", "imagebrowser", new { Area = "cms" })
        .Thumbnail("thumbnail", "imagebrowser", new { Area = "cms" })
    )
)
Can anyone tell me why these two methods would give different results? I've attached screenshots.

Using fiddler both methods make the same exact web request and get the same exact json response.

4 Answers, 1 is accepted

Sort by
0
Eric
Top achievements
Rank 1
answered on 30 Sep 2013, 07:52 PM
Turns out if I add the type "imagebrowser-aspnetmvc" it resolves my issue, not sure if this is intended but it's undocumented.
transport: {
        type: "imagebrowser-aspnetmvc",
        read: "/cms/imagebrowser/read",
        destroy: "/cms/imagebrowser/destroy",
        create: "/cms/imagebrowser/create",
        thumbnailUrl: "/cms/imagebrowser/thumbnail",
        uploadUrl: "/cms/imagebrowser/upload",
        imageUrl: "/content/cms/images/{0}"
    }
0
elke
Top achievements
Rank 1
answered on 08 Feb 2017, 01:55 PM
briljant!
0
wortho
Top achievements
Rank 2
answered on 02 Feb 2018, 08:23 AM
Wow - I have been struggling with this for a couple of hours, great find thanks!
0
Dimitar
Telerik team
answered on 05 Feb 2018, 03:38 PM
Hello Steve,

Using the built-in ImageBrowserController/FileBrowserController classes from Kendo.MVC assembly requires use of the imagebrowser-aspnetmvc/filebrowser-aspnetmvc transport type on the client-side. This is needed as the transport uses specific parameterMap which formats the request parameters in the appropriate way.

When using the HtmlHelpers from the Telerik UI for ASP.NET MVC suite, the specified transport type is set automatically, thus there is no need to set it explicitly.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Editor
Asked by
Eric
Top achievements
Rank 1
Answers by
Eric
Top achievements
Rank 1
elke
Top achievements
Rank 1
wortho
Top achievements
Rank 2
Dimitar
Telerik team
Share this question
or