Duplicated
Last Updated: 16 Jun 2022 06:52 by ADMIN
Benjamin
Created on: 11 May 2022 10:46
Category: FileSelect
Type: Feature Request
7
FileSelect Button text

Hey Telerik-Team,

unfortunatelly we're not able to set the button text for the file input. The <span> is empty and the component does not allow setting the caption:

Code:

HTML:

Output:

No ChildComponent seems to be allowed - when I manually modify the html and put something in the empty <span>, the text appears:

Duplicated
This item is a duplicate of an already existing item. You can find the original item here:
2 comments
Benjamin
Posted on: 09 Jun 2022 13:28

Hi Marin,

with that information, I figured out, that we had indeed a missing localization string ("FileSelect_SelectFiles"). It now has a proper value :)

Nevertheless it would be great to add a parameter to the TelerikFileSelect with a custom caption.

The changes would be fairly simple on your side:

 

TelerikFileSelect.cs:

Add (around line 40):

[Parameter] public string? SelectTitle {get;set;}

Change line 238:

__builder.AddAttribute(12, "Text", RuntimeHelpers.TypeCheck<string>(BaseComponent.Localizer["FileSelect_SelectFiles"]));

to:

__builder.AddAttribute(12, "Text", SelectTitle ?? RuntimeHelpers.TypeCheck<string>(BaseComponent.Localizer["FileSelect_SelectFiles"]));

 

2 lines of code and everyone using the FileSelect can change the caption to "Click here to upload avatar" or "Click here to upload backup", ... you name it. A nice improvement :)

 

Regards

ADMIN
Marin Bratanov
Posted on: 11 May 2022 19:30

Hello Benjamin,

Pease post a simple runnable reproducible in REPL so we can take a look. At the moment it looks like a localization string might be missing from the app's localization implementation.

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