RadUpload AddButton Text

Thread is closed for posting
4 posts, 0 answers
  1. Bryan Brannon
    Bryan Brannon avatar
    65 posts
    Member since:
    Aug 2012

    Posted 21 May 2008 Link to this post

    Is it possible to change the text / wording on the AddButton either in the designer or at runtime?
  2. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 22 May 2008 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Andrea
    Andrea avatar
    64 posts
    Member since:
    Jan 2005

    Posted 06 Jun 2008 Link to this post

    And to customize "Select" and/or "Clear" buttons?

    Thanks.
  5. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 09 Jun 2008 Link to this post

    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
Back to Top