Telerik Forums
UI for ASP.NET Core Forum
0 answers
205 views

I want to disable drag and drop images from local folders or copy paste the images from clipboard into the Kendo Editor (https://demos.telerik.com/aspnet-core/editor). 
I am using this function emailEditorPaste() to prevent such ,

function emailEditorPaste(e) { var clipboardData = e.event.clipboardData || window.clipboardData; var items = clipboardData.items; for (var i = 0; i < items.length; i++) { var item = items[i]; if (item.type.indexOf("image") !== -1) { e.preventDefault(); console.log("Images cannot be pasted here"); break; } } }

and I have appended it to the Paste events on Editor as in here
@(Html.Kendo().EditorFor(m => m.MsgT.body) . .Tools(tools => tools .Clear() .FontName().FontSize() .Bold().Italic().Underline() .JustifyLeft().JustifyCenter().JustifyRight() .ForeColor().BackColor() .InsertUnorderedList().InsertOrderedList() .Outdent().Indent() .CreateLink().Unlink() .InsertImage() ) .Events(events => events .Change("emailEditorChange") .Paste("emailEditorPaste")

emailEditorPaste() works fine in not allowing me the user to drag and drop the images but when I have a text copied to clipboard and I try to paste it into editor , it doesn't paste on first attempt and throws a console error:
"Cannot read properties of undefined (reading 'clipboardData')
TypeError: Cannot read properties of undefined (reading 'clipboardData')" .

On second attempt the text is pasted into the editor just fine.

I looked all places but I am still missing something, can you please share me some resources on how to disable the drag and drop images into the editor.

shashank
Top achievements
Rank 1
Iron
 asked on 28 Aug 2023
1 answer
337 views

I need to show the notification on my razor page. The message comes from the controller. Below is what I have:

 

 public ActionResult Index()
        {
           

            if (test == "Success")
                return View("Successfully stored);
            else
                return View("failed to store");
        }

 

On My razor page, I want to show the Success notification message when test is Success otherwise show the failure message. How can I achieve this. I don't want to click any button to show the success and failure notification.

Mihaela
Telerik team
 answered on 28 Aug 2023
1 answer
155 views

Hi there,

I'd like to trigger the virtualization scroll event programatically. My idea is to use a global body scroller to register the scroll down, and completely turn off the scroller on the listview container.

When I use the following code it will only replace my existing rows.

$("#allProductsListView").data("kendoListView").dataSource.read({ page: 2, pageSize: 36 })

I need a way to append in order to make virtualization work programatically.

Thank you.

Mihaela
Telerik team
 updated answer on 28 Aug 2023
1 answer
178 views

I need grouping, filtering, sorting for a column. When I'm trying to bind to a field of an object which can be null, I get:

Uncaught TypeError: Cannot read properties of null (reading 'Name')

kva
Top achievements
Rank 2
Iron
Iron
Iron
 updated answer on 28 Aug 2023
2 answers
502 views

Hello,

can be hidden Saturdays and Sundays from the scheduler control in all views and how?

Many thanks!

 

Michel
Top achievements
Rank 1
Iron
 answered on 27 Aug 2023
1 answer
177 views

I am looking for a sample of a responsive pie chart. I have tried different suggestions from the forums but none seem to work. Is there a fully worked sample I can reference?

Alexander
Telerik team
 answered on 25 Aug 2023
1 answer
287 views
I am not able to resize chart w.r.t. height and width. If I do so area is getting cut. 
Georgi Denchev
Telerik team
 updated answer on 25 Aug 2023
1 answer
495 views

I have a situation where certain users should be able to view data in a grid, but not be able to edit it. It looks like there are ways to disable individual elements of the grid, but is there a way to make it entirely readonly?

[edit: of course as soon as I finished typing this a co-worker made a suggestion that works. Simply putting the grid in a div with the class k-state-disabled does the trick]

Vasko
Telerik team
 answered on 24 Aug 2023
1 answer
149 views

I have grid, which has a boolean column, I want after page loading, to show only records with true value of the boolean column. I'm using row filtering, and I also want to show filter controls for this column activated on true value. I turned off server operations.

kva
Top achievements
Rank 2
Iron
Iron
Iron
 answered on 23 Aug 2023
1 answer
463 views

Hello,

I am letting users to upload a pdf file on the browser. Once the user upload the file, I want to give them the option to view the uploaded file. In order to upload the file, I am using ASP.NET Core Upload Asynchronous Upload control and it works fine, but I am not sure how can I have the user view the pdf file as soon as it uploads. The files exists on server. Below is my entire code:

 


@using Kendo.Mvc.UI
<div style="margin-top:60px">
    <div>
        <span style="font-size:20px; font-weight:bold">Upload File</span>

    </div>
    <br />  <br />  
        <div class="block-section">
        @(Html.Kendo().Upload()
            .Name("files")
            .Async(a => a
                .Save("Async_Save", "Block")
                .Remove("Async_Remove", "Block")
                .AutoUpload(true)
            )
        )
    </div>


below is my controller code:


 public async Task<IActionResult> Async_Save(IEnumerable<IFormFile> files)
        {


            foreach (var file in files)
            {
                var fileContent = ContentDispositionHeaderValue.Parse(file.ContentDisposition);


                var fileName = Path.GetFileName(fileContent.FileName.ToString().Trim('"'));
                var physicalPath = Path.Combine(_webHostEnvironment.WebRootPath, "UploadedFiles", fileName);
                using (var fileStream = new FileStream(physicalPath, FileMode.Create))
                {
                    await file.CopyToAsync(fileStream);
                }

               
            }
            return Content("");
        }

The file that is uploaded by the user using the above control, I want the user to see that file. I know Telerik has pdfViewer, but I am not sure how the pdfViewer can show the file that exists on the server. The files is uploaded and saved on a folder in wwwRoot. i dont know the name of the file. Below is what I am trying to use:

 


 <div>
        @(Html.Kendo().PDFViewer().Name("pdfviewer")
            .PdfjsProcessing(pdf => pdf.File(Url.Content("~/wwwroot/UploadedFiles/2020-0598857.pdf")))
            .Height(1200)
            )

    </div>
but I  dont have the file name. User can name the file and upload it and I want the user to preview the file.
Mihaela
Telerik team
 answered on 21 Aug 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?