MVC Core Kendo Upload Excel and Read uploaded file

1 Answer 625 Views
Grid Upload
Gaysorn
Top achievements
Rank 1
Iron
Gaysorn asked on 21 Feb 2023, 02:01 PM

Hi, 

I'm working on develop web application using MVC Core with Razor. I'm using kendo upload to upload excel file.  After I got the uploaded excel file, I want to read the data to the temp table (or grid if possible). How do I get to the Posted File InputSteam to read  or loop data to temp table? With asp.net web form, I used PostedFile.InputSteam to read data, how do I do that with kendo upload control?

Thank you for your help.

 

1 Answer, 1 is accepted

Sort by
0
Mihaela
Telerik team
answered on 24 Feb 2023, 10:57 AM

Hello Gaysorn,

The Upload component exposes the Files() configuration that allows you to load files when the component is initialized.

For example, you could pass the file information to the View through a Model, and display it in the Upload files list:

//View

@model List<FileViewModel>

        @(Html.Kendo().Upload()
            .Name("files")
            ...
            .Files(files =>
            {
               if (Model != null)
               {
                    foreach (var file in Model)
                    {
                        files.Add().Name(file.Name).Extension(file.Extension).Size(file.Size);
                    }
               }
            })
        )

Also, you can customize further the Upload files list by using the TemplateId() option, as demonstrated in the online demo:

https://demos.telerik.com/aspnet-core/upload/templates

I hope that helps. If any additional questions arise, don't hesitate to let me know.

 

Regards, Mihaela Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid Upload
Asked by
Gaysorn
Top achievements
Rank 1
Iron
Answers by
Mihaela
Telerik team
Share this question
or