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

RadUpload AddButton Text

3 Answers 140 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Bryan Brannon
Top achievements
Rank 2
Bryan Brannon asked on 22 May 2008, 01:44 AM
Is it possible to change the text / wording on the AddButton either in the designer or at runtime?

3 Answers, 1 is accepted

Sort by
0
Erjan Gavalji
Telerik team
answered on 22 May 2008, 11:12 AM
Hi Bryan,

To my regret currently the localization possibilities of the RadUpload for ASP.NET Ajax control are very limited. We are working on fixing this for the RadControls for ASP.NET Ajax Q1 2008 SP2 release. In the meantime you can use the following client-side JavaScript workaround:

<script type="text/javascript">
    function pageLoad()
    {
        var upload = $find("<%=RadUpload1.ClientID %>");
        if (upload.get_controlObjectsVisibility() & Telerik.Web.UI.ControlObjectsVisibility.AddButton)
        {
            var uploadElement = upload.get_element();
            var inputs = uploadElement.getElementsByTagName("input");
            for (var i=0; i<inputs.length; i++)
            {
                var input = inputs[i];
                if (input.id == upload.get_id() + "AddButton")
                {
                    input.value = "Add more files?";
                }
            }
        }
    }
</script>

Let me know if that helps.

Kind regards,
Erjan Gavalji
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Andrea
Top achievements
Rank 2
Iron
answered on 06 Jun 2008, 03:22 PM
And to customize "Select" and/or "Clear" buttons?

Thanks.
0
Veselin Vasilev
Telerik team
answered on 09 Jun 2008, 02:29 PM
Hi Andrea,

Here is how to customize the text of all inputs of RadUpload:

<telerik:RadUpload ID="RadUpload1"  
    OnClientAdded="OnClientAddedHandler" 
    runat="server"  
    ControlObjectsVisibility="All" /> 

<script type="text/javascript"
function OnClientAddedHandler(upload, eventArgs) 
{    
    if (upload.get_controlObjectsVisibility()) 
    { 
        var uploadElement = upload.get_element(); 
        var inputs = uploadElement.getElementsByTagName("input"); 
        for (var i = 0; i < inputs.length; i++) 
        { 
            var input = inputs[i]; 
            var id = input.id; 
            //customize the Add Button 
            if (id == upload.get_id() + "AddButton"
            { 
                input.value = "Custom AddButton"
            } 
            //customize the Remove button 
            if (id.indexOf(upload.get_id() + "remove") > -1) 
            {                 
                input.value = "Delete it"
            } 
            //customize the Clear button 
            if (id.indexOf(upload.get_id() + "clear") > -1) 
            {                 
                input.value = "Clear it"
            } 
            //customize the Select button                             
            if (input.className == "ruButton ruBrowse"
            { 
                input.value = "Browse it"
            }  
            //customize the Delete button 
            if (id == upload.get_id() + "DeleteButton"
            { 
                input.value = "Custom Delete"
            } 
        } 
    } 
</script>   

It is better to do the customization in the OnClientAdded event because it will fire every time you click on the Add button and all new upload rows will have the new values.

This code will be available in the help after the next site update.

I hope this helps.

Greetings,
Veskoni
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Upload (Obsolete)
Asked by
Bryan Brannon
Top achievements
Rank 2
Answers by
Erjan Gavalji
Telerik team
Andrea
Top achievements
Rank 2
Iron
Veselin Vasilev
Telerik team
Share this question
or