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

ImageBrowser and FileBrowser in razor page

3 Answers 293 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Renjith
Top achievements
Rank 1
Renjith asked on 28 Nov 2018, 05:47 PM
How do we call Kendo UI ajax calls like read,update etc.. in razor pages. The demo is for MVC. Appreciate if you can provide one with an example.

3 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 03 Dec 2018, 08:18 AM
Hello Renjith,

In case you would like to use the built-in sever implementation of the Editor, a new Controller has to be defined that inherits from the built-in EditorImageBrowserController in the Kendo.Mvc.dll. This scenario is demonstrated on the following Demo, where the code for the controller can be inspected:


Alternatively, if the above does not suit the project requirements, you could provide you own implementation by configuring the page handlers as follows:
@(Html.Kendo().Editor()
  .Name("editor")
  .HtmlAttributes(new { style = "height:440px" })  
  .ImageBrowser(imageBrowser => imageBrowser
  .Image("~/Content/UserFiles/Images/{0}")
    .Transport(t => {
      t.Read(r => r.Url("/Index?handler=read"));
      t.Create(c => c.Url("/Index?handler=create"));
      t.Destroy(d => d.Url("/Index?handler=destroy"));
      t.ThumbnailUrl("/Index?handler=thumbnail");
    })   
  )
)

Regards,
Dimitar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Joel
Top achievements
Rank 1
Iron
answered on 06 Sep 2019, 04:44 AM

Hi Dimiatr,

   Can the ImageBrowser run as a standalone widget without the Editor in ASP.Net Core?

   There is a link here Using Image Browser Without Editor but it is for ASP.Net MVC.

p/s: i am very new in ASP.Net Core. So do pardon me if i need things to be more explicit.

0
Joel
Top achievements
Rank 1
Iron
answered on 06 Sep 2019, 10:24 AM

Let me answer my own question.

Here is what i have done & it is working.

<div>
                    @(Html.Kendo().PanelBar()
                        .Name("panelbar")
                        .ExpandMode(PanelBarExpandMode.Multiple)
                        .Items(panelbar =>
                        {
                            panelbar.Add().Text("Image Browser")
                                .Expanded(false)
                                .Content(@<div id="imgBrowser"/>);
                        })
                    )
</div>
 
<script>
   $("#imgBrowser").kendoImageBrowser({
        transport: {
            type: "imagebrowser-aspnetmvc",
            read: "/ImageBrowser/Read",
            destroy: {
                url: "/ImageBrowser/Destroy",
                type: "POST"
            },
            create: {
                url: "/ImageBrowser/Create",
                type: "POST"
            },
            imageUrl: "@Url.Content("~/shared/UserFiles/Images/{0}")",
            thumbnailUrl: "/ImageBrowser/Thumbnail",
            uploadUrl: "/ImageBrowser/Upload",
        },
        change: insertImagePath
    });
</script>
Tags
Editor
Asked by
Renjith
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Joel
Top achievements
Rank 1
Iron
Share this question
or