Telerik Forums
UI for ASP.NET MVC Forum
1 answer
48 views

I'm using the Kendo for ASP.Net MVC Upload control. I'm on version 2019, and upgrading right now is not an option unfortunately. When the user chooses a file (multi-select is off), I have a Submit button separate from the control that the user clicks to begin the upload. While the upload is taking place, I want the Choose File button to be disabled. I need the pause and cancel buttons enabled, so it won't work to disable the entire control. I have a place to put some javascript to disable the button, but everything I've tried so far doesn't accomplish disabling the button. 

Here is the declaration of the control:

                        <div id="uploadControlContainer" class="upload-input col-sm-12">
                            @(Html.Kendo().Upload()
                                .Name("chunkContent")
                                .Async(a => a
                                    .Batch(false)
                                    .Save("UploadLargeFileChunk", "DocumentUpload")
                                    //.Remove("Remove", "DocumentUpload") not implemented
                                    .AutoUpload(false)
                                    .ChunkSize(Model.ChunkSize)
                                    .AutoRetryAfter(Model.AutoRetryAfter)
                                    .MaxAutoRetries(Model.MaxAutoRetries)
                                )
                                .Multiple(false)
                                .Events(e => e.Select("onSelectFile"))
                                .Events(e => e.Upload("onUploadChunk"))
                                .Events(e => e.Cancel("onCancelUpload"))
                                .Events(e => e.Success("onUploadSuccess"))
                                .Events(e => e.Error("onUploadError"))
                                .Messages(m => m.Select("Choose File"))
                            )
                        </div>

 

Mihaela
Telerik team
 answered on 06 Feb 2025
1 answer
55 views

Hi,

I have have a requirement, where I need to upload an excel file. After uploading the excel file when the user clicks Import button then all the excel data should add to the Kendo grid.

I am using .Net 8 with MVC Razor page to achieve this. Is there any library I have to use to read the excel data to kendo grid or the kendo grid 

have some API(s) which can read the excel file and update the grid.

This is my excel records. 

This is my application, when the user upload this above excel and click on import from Excel, then the above excel records should fill in the

kendo grid.

 

 

Eyup
Telerik team
 answered on 23 Jan 2025
0 answers
99 views
Im trying to find a way to continue with upload of multiple files if one fails. I have a check on Save that if file names is longer then 100 chars, it will return a error. Upload will stop on that file, and will only continue when user click on X button to remove the file. I need for kendo upload to continue with the upload of other files without user having to click on X button for each file that files. 
Bexel Consulting
Top achievements
Rank 1
Iron
Iron
 asked on 07 Aug 2024
0 answers
123 views

Hi

My req is to save the documents in database in blob format. When user submits the form, the form will be saved in database and then with saved formid as reference key uploaded documents will be saved in documents table.

When user edits submitted form, I need to display already attached forms on the page. User may delete or attach new forms in edit screen.

When user viewing the form in read only mode, user should be able to download the form. How can i achieve this? 

 

below code is working for uploading...


<div class="row col-md-12">
                    <div class="col-md-10">
                        <div class="form-group">
                            @Html.LabelFor(model => model.files, htmlAttributes: new { @class = "control-label col-md-4" })
                            <div class="col-md-8">
                                @(Html.Kendo().Upload()
                                    .Name("files")
                                    .Validation(validation => validation
                                    .AllowedExtensions(new string[] { ".pdf", ".txt", ".xlsx", ".xls", ".doc", ".docx" })
                                    .MaxFileSize(15728640)
                                    .MinFileSize(3000))
                                    .ShowFileList(true)
                                    .HtmlAttributes(new { aria_label = "files" })
                                )
                                @Html.ValidationMessageFor(model => model.files, "", new { @class = "text-danger" })
                            </div>
                        </div>
                    </div>
                </div>

 

 


viewmodel class

[Display(Name = "Upload relevant documents")]
public IEnumerable<HttpPostedFileBase> files { get; set; }








foreach (var file in vm.files)
{
       byte[] document = new byte[file.ContentLength];
       file.InputStream.Read(document, 0, file.ContentLength);

       RLADOCUMENT rd = new RLADOCUMENT
       {
           RLAFORMID = (int)entity.ID,
           DOCUMENTNAME = file.FileName,
           CONTENTTYPE = file.ContentType,
           DOCUMENTSIZE = document.Length,
           DOCUMENTDATA = document,
           CREATEDBY = Environment.UserName,
           CREATEDDATE = DateTime.Now,
           EXTENSION = Path.GetExtension(file.FileName)
       };
       _context.RLADOCUMENTS.Add(rd);
       _context.SaveChanges();
}

 

Can someone help me how to display already attached files in Edit Mode with remove and upload option and download the attached reports.

Babu
Top achievements
Rank 1
Iron
Iron
Iron
 asked on 22 Apr 2024
1 answer
112 views

How to display the "File(s) saved successfully in the Custom Kendo Upload Template.

 

Using the template below:

<span class='k-progress'></span>
<div class='file-wrapper'>
    <span class='file-icon #=addExtensionClass(files[0].extension)#'></span>
    <div class='file-heading file-name-heading'>Name: #=name#</div>
    <div class='file-heading file-size-heading'>Size: #=kendo.toString(size/1024,"n2")# KB</div>
    <div class="file-heading file-error-heading">
    #if (files[0].error) { # <span class="k-file-validation-message"> #= files[0].error # </span> # } #
    </div>
</div>
Mihaela
Telerik team
 answered on 28 Mar 2024
1 answer
267 views

I'm using Kendo v 2023.2.606 from the Kendo CDN.
In my view I have the following code:

<div class="row row-cols-lg-auto gx-3 gy-2 align-items-baseline mt-2">
    <div class="col">
        <h4>Choose File</h4>
        <!-- upload a file -->
        @(Html.Kendo().Upload()
            .Name("files")
            .Multiple(false)
            .ShowFileList(false)
            .Async(_ => _
                .Save("SubmitFile", "DataImport", new { Area = "Admin" })
                .Batch(true)
                .AutoUpload(true)
            )
            .Events(_ => _
                .Upload("onUpload")
                .Success("onUploadSuccess")
                .Error("onUploadFail")
            )
            .Validation(_ => _
                .AllowedExtensions(new string[] { "xls", "xlsx", "csv" })
                .MaxFileSize(3145728)
            )
        )
    </div>
</div>

If I select a file with an extension that is not listed, e.g. .zip, or I select a file that is more than 3.14MB all I see is this:

It does not hit my MVC controller action (which is fine) but the only indication of a problem is the (!) icon. The icon is not clickable.

Why is it not displaying a message saying the file is not valid/too big?

Ivan Danchev
Telerik team
 answered on 20 Mar 2024
1 answer
85 views
Hi everyone, I need help with the trial plan. I'm currently using MVC version 5.2.7 in my project, but the version required for the Telerik trial version is 5.2.9. How can I get an older version?
1 answer
262 views

Has anyone else noticed that neither the .Net core or MVC upload module works when run under iOS? https://www.telerik.com/aspnet-core-ui/upload

If you try and upload anything you can never click submit.

 You can try it on the demo here on any iOS device - 

https://demos.telerik.com/aspnet-core/upload?_ga=2.7918193.219391470.1689953144-110638612.1682430985&_gl=1*wzaau5*_ga*MTEwNjM4NjEyLjE2ODI0MzA5ODU.*_ga_9JSNBCSF54*MTY4OTk1MzE0NC4xMS4xLjE2ODk5NTQxMDguNjAuMC4w

This seems to have broken when the move was made to go to Sass from Less a few months ago. It worked fine in Less. With it being such a major component it is something that you would hope gets fixed very quickly. 

Alexander
Telerik team
 answered on 25 Jul 2023
1 answer
150 views

I have a form as follows where it fires validation for text box controls but not for file upload


<form id="frmItem">
    <table class="table table-bordered">
        <thead class="bg-dark text-center text-white">
            <tr>
                <th colspan="2">Add/Modify Item</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td style="width:404px;">Item ID Name</td>
                <td>
                    @(Html.Kendo().TextBox().Name("txtItemName")
                        .HtmlAttributes(new { placeholder = "Item ID Name", required = "required", validationmessage = "Enter Item ID Name" }))
                </td>
            </tr>
            <tr>
                <td>UN Number</td>
                <td>
                    @(Html.Kendo().TextBox().Name("txtUnNumber")
                        .HtmlAttributes(new { placeholder = "UN Number", required = "required", validationmessage = "Enter UN Number" }))
                </td>
            </tr>
            <tr>
                <td>Packing Instructions</td>
                <td>
                    @(Html.Kendo().TextBox().Name("txtPackingInstructions")
                        .HtmlAttributes(new { placeholder = "Packing Instructions", required = "required", validationmessage = "Enter Packing Instructions" }))
                </td>
            </tr>
            <tr>
                <td>SDS Sheet</td>
                <td>
                    @(Html.Kendo().Upload().Name("SdsSheet")
                        .Multiple(false)
                        .HtmlAttributes(new { required = "required" }))
                </td>
            </tr>
            <tr>
                <td>Cargo Only?</td>
                <td>@(Html.Kendo().CheckBox().Name("txtCargoOnly"))</td>
            </tr>
            <tr>
                <td>Example Shipment Ground (Fully Regulated)</td>
                <td>@(Html.Kendo().Upload().Name("GroundShipment"))</td>
            </tr>
            <tr>
                <td>Example Shipment Next Day Air (Fully Regulated)</td>
                <td>@(Html.Kendo().Upload().Name("NextDayShipment"))</td>
            </tr>
            <tr>
                <td>Example Shipment Freight (Fully Regulated)</td>
                <td>@(Html.Kendo().Upload().Name("FreightShipment"))</td>
            </tr>
            <tr>
                <td>Example Shipment Ground (Limited Quantity)</td>
                <td>@(Html.Kendo().Upload().Name("GroundShipmentLimited"))</td>
            </tr>
            <tr>
                <td>Example Shipment Next Day Air (Limited Quantity)</td>
                <td>@(Html.Kendo().Upload().Name("NextDayShipmentLimited"))</td>
            </tr>
            <tr>
                <td>Example Shipment Freight (Limited Quantity)</td>
                <td>@(Html.Kendo().Upload().Name("FreightShipmentLimited"))</td>
            </tr>
            <tr>
                <td colspan="2">
                    <button class="k-button k-button-solid-primary k-button-solid k-button-md k-rounded-md" type="submit">Submit</button>
                </td>
            </tr>
        </tbody>
    </table>
</form>
<script>
    $(document).ready(function () {
        var validator = $("#frmItem").kendoValidator().data("kendoValidator");

        $("#frmItem").submit(function (event) {
            event.preventDefault();

            if (validator.validate()) {
                
            } else {
                
            }
        });
    });
</script>

Ivan Danchev
Telerik team
 answered on 05 Jul 2023
1 answer
493 views

Good day,

i Just updated kendo ui mvc project to the latest version currently out yesterday. now its broken.

before upgrade

 

after upgrade

 

Ivan Danchev
Telerik team
 answered on 10 May 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?