Completed
Last Updated: 22 Feb 2022 08:33 by ADMIN
Alan
Created on: 08 Jul 2020 06:51
Category: Upload
Type: Feature Request
19
Trigger File Select dialog from my own button

I would like to have my users click my own button or element to trigger the file select dialog that you get from clicking the "Select Files..." button on the Upload component.

A workaround is to use a function like this

window.customUploadClick = function () {
    $('.k-upload-button input').trigger('click');
}

---

ADMIN EDIT

 

Completed with 3.0.0 release

 

If you are not using jQuery already, you don't have to add it for this, standard browser API can do this too:

 

@inject IJSRuntime _js

<script suppress-error="BL9992">
    window.customUploadClick = function () {
        document.querySelector(".k-upload-button input").click();
    }
</script>

<TelerikButton OnClick="@InvokeSelectClick">invoke click</TelerikButton>

<TelerikUpload></TelerikUpload>

@code{
    async Task InvokeSelectClick()
    {
        await _js.InvokeVoidAsync("customUploadClick");
    }
}

 

---

3 comments
ADMIN
Joana
Posted on: 22 Feb 2022 08:33

Hi,

I apologize for the misunderstanding. The feature is available with our 3.0 release through `OpenFileSelectAsync`. You can test the behavior in our demo site:

https://demos.telerik.com/blazor-ui/upload/customization 

Regards,
Joana
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

ADMIN
Marin Bratanov
Posted on: 08 Feb 2022 21:18

Hi Randy,

At the moment- yes. This feature request aims at allowing you to do that without writing JS yourself.

I added your Vote to it on your behalf and you can click the Follow button for emails with status updates.

Regards,
Marin Bratanov
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/.

Randy
Posted on: 03 Feb 2022 23:14
So the only way to do this is to use JavaScript?