This question is locked. New answers and comments are not allowed.
How do I set the text of the "Select..." button. I tried using jquery but when I do the button ceases to work:
$("[class^='t-button t-upload-button']").select("span").html("My Custom Text");
9 Answers, 1 is accepted
0
Accepted
Hi Travis,
Here is how to do that - you need to add a custom attribute to the upload component and then reference the span container by it:
Regards,
Georgi Tunev
the Telerik team
Here is how to do that - you need to add a custom attribute to the upload component and then reference the span container by it:
<%= Html.Telerik().Upload()
.Name("attachments")
//add a custom attribute
.HtmlAttributes(new { @class = "myCustomClass" })
.Async(async => async.Save("Save", "Home"))
%>
<
button
onclick
=
"changeText(); return false;"
>
Change the button text</
button
>
<
script
type
=
"text/javascript"
>
function changeText() {
$(".myCustomClass").find('span:first').text("Custom text");
}
</
script
>
Regards,
Georgi Tunev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Levi
Top achievements
Rank 1
answered on 11 Nov 2011, 11:39 PM
I too couldn't figure out how to change the "Select..." text. I first looked in the documentation and found nothing. Then I looked here and found this post. I thought to myself I guess I could use jquery to find the span and change the content, but surely I shouldn't have to do that just to simply change some text content. While technically this is not at all difficult to do, it's still seems like a hack and something that shouldn't be the user of the controls responsiblity. It should also be clear in the documentation that this is the only way to set the content of the span.
Has Telerik considered either 1) Documenting this or 2) Add a parameter that allows the user to set the content of the span?
Sorry for complaining, but this was really irritating and seemed out of place for such great controls.
Thanks!
Has Telerik considered either 1) Documenting this or 2) Add a parameter that allows the user to set the content of the span?
Sorry for complaining, but this was really irritating and seemed out of place for such great controls.
Thanks!
0
Hello Levi,
Georgi Tunev
the Telerik team
The reply given above assumes that you need to change the text dynamically, via JavaScript. Since such feature is rarely used, we don't have a client API for it and it requires some additional client coding. The easiest approach of course is to change the localization in the resource files.
Georgi Tunev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Samir
Top achievements
Rank 1
answered on 15 Feb 2012, 01:36 AM
Hi Georgi,
The time I apply this code
the upload button stops working when I click it. I am missing another step. It does it in all browsers.
Thanks.
The time I apply this code
$(
'.t-upload span:first'
).text(
'Open'
);
the upload button stops working when I click it. I am missing another step. It does it in all browsers.
Thanks.
0
Hello Samir,
The code is working as expected on my side. If you added the full code from the sample above and still experience problems, please you provide a sample project so I can check it.
Regards,
Georgi Tunev
the Telerik team
The code is working as expected on my side. If you added the full code from the sample above and still experience problems, please you provide a sample project so I can check it.
Regards,
Georgi Tunev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Steven
Top achievements
Rank 1
answered on 07 Mar 2012, 07:02 AM
Thank you for the code snippet. I am using it in the onLoad event for upLoad control and it works great. Now I need to change the width of the button to support the new button text. Could you please let me know how this is done? Thanks.
0
Kajal
Top achievements
Rank 1
answered on 03 Apr 2012, 07:42 PM
This will change the width of the button:
$(".myCustomClass").find('span:first')
.parents('div:first').width(250);Thanks
0
Water
Top achievements
Rank 1
answered on 16 May 2012, 12:01 PM
If you don't need to change the text dynamically, you can just set it in the aspx code.
See http://www.telerik.com/help/aspnet-ajax/asyncupload-localizing.html for more info.
<telemeter:radasyncupload id="RadAsyncUpload1" runat="server" localization-select="Select zip file" />
See http://www.telerik.com/help/aspnet-ajax/asyncupload-localizing.html for more info.
0
Hello Water,
The code snippet that you provided is about asp.net ajax RadAsyncUpload, while the main topic in this forum thread is ASP.NET MVC related.
Regards,
Iliana Nikolova
the Telerik team
The code snippet that you provided is about asp.net ajax RadAsyncUpload, while the main topic in this forum thread is ASP.NET MVC related.
Regards,
Iliana Nikolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.