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

Label / Button

8 Answers 986 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Alan
Top achievements
Rank 1
Iron
Iron
Iron
Alan asked on 02 Jul 2020, 08:44 PM
I would like to have the upload component but change the text on the button or, even better, create a Telerik button and call the upload functionality. That way, the button could have theming, etc. and only the upload would need to be called. Any pointers on how I can accomplish either task (especially calling from a button)?

8 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 03 Jul 2020, 07:46 AM

Hi Alan,

The button is already themed, and you can change its text through localization (including the default string): https://demos.telerik.com/blazor-ui/upload/globalization. In the demo you can also change the theme to see how it looks.

As for invoking the upload manually - there is a built-in feature for that - setting the AutoUpload parameter to false will give your users an explicit Upload button they must click before the actual request to the server is sent. This property defaults to true, as we believe it provides better UX that way for the majority of cases.

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
khashayar
Top achievements
Rank 1
Veteran
answered on 06 Jul 2020, 08:00 AM
hello, 
yes the localization works but i also need to change the whole text to another one how can i do it ?
0
Marin Bratanov
Telerik team
answered on 06 Jul 2020, 08:10 AM

Hello Khashayar,

I am attaching a video from the demo that shows how localization changes the entire text of the button.

I'd suggest you download our demos (you can find them in the "demos" folder in your local installation) with our latest version and see how that works on the demos so you can emulate that. You can also see the Globalization article for details and examples.

If you have issues with that, please open a support ticket and send us a simple runnable example that showcases the problem so we can have a look.

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
khashayar
Top achievements
Rank 1
Veteran
answered on 07 Jul 2020, 10:45 AM
yes this is how localization works but i need to change the button text to a completely diferent text like i want to change Select files...
to Upload image
0
Daniel
Top achievements
Rank 1
answered on 07 Jul 2020, 11:19 PM

Hi Khashayar,

I also wanted to use a custom button to trigger the file upload from elsewhere on my form. I have my custom button trigger a JavaScript interop call, which in turn triggers the "Select files" button on the TelerikUpload control.  The trick is to trigger the click event on the input element inside the button div, not the button div itself.  Here is a simple example of the javascript.  This assumes you only have one upload control on the form...if not you can get creative and pass container classes or other identifiers.  Hope this helps.

window.customUploadClick = function () {
    $('.k-upload-button input').trigger('click');
}
0
Alan
Top achievements
Rank 1
Iron
Iron
Iron
answered on 08 Jul 2020, 04:59 AM

Ok, I finally had a chance to see what Marin is describing. Check out this file in the git repo:

https://github.com/telerik/blazor-ui/blob/master/common/localization/ClientLocalizationResx/Shared/Resources/TelerikMessages.resx

~Line 598 shows you where to change the text. Makes sense but I think it would be good to have a simpler way to handle it. That is my personal opinion. Perhaps a Text property or label or Content tag. Telerik devs know better than I do on how to handle it but simpler usage would be helpful. 

0
Marin Bratanov
Telerik team
answered on 08 Jul 2020, 06:54 AM

Hi all,

I made these Feature Request pages in the Feedback Portal so you can Follow the implementation status of such ideas. I have added the Votes of the people who participated in this discussion, and anyone else can also Vote for an item to raise its priority.

You may also find interesting this one for a custom area to drop files into: https://feedback.telerik.com/blazor/1471026-custom-droptarget-for-telerikupload. If so, Vote for, and Follow it.

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Alan
Top achievements
Rank 1
Iron
Iron
Iron
answered on 08 Jul 2020, 02:31 PM
Awesome. Thank you.
Tags
Upload
Asked by
Alan
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Marin Bratanov
Telerik team
khashayar
Top achievements
Rank 1
Veteran
Daniel
Top achievements
Rank 1
Alan
Top achievements
Rank 1
Iron
Iron
Iron
Share this question
or