Render button as links

Thread is closed for posting
3 posts, 1 answers
  1. Jeff
    Jeff avatar
    29 posts
    Member since:
    Nov 2006

    Posted 15 Aug 2008 Link to this post

    Hi,

    I would like to render the remove and add buttons as links rather than buttons, is this possible?

    I don't think the add button is such a problem as i can just add javascript to an anchor to call the addFileInput method.  The problem I am having is with creating a remove link, I will still render a remove link per file input, but how do you track or get the index to call the deleteFileInputAt method?  Can you give me an example, I can't seem to figure out how your remove button works?

    I currently have:

    function OnClientAddedHandler(upload, eventArgs) {  
                if (upload.get_controlObjectsVisibility()) {  
                    var row = eventArgs.get_row();  
                    var removeRowLink = document.createElement("a");  
                    removeRowLink.href = WHAT DO I PUT HERE??  
                    removeRowLink.title = "remove file";  
                    removeRowLink.innerHTML = "remove";  
                    row.appendChild(removeRowLink);  
                }  
            } 

    Am I going in the right direction here?

    Thanks,

    Jeff
  2. Answer
    Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 15 Aug 2008 Link to this post

    Hi Jeff,

    To my regret replacing the RadUpload buttons with links is not possible, as RadUpload expects them to be <input type="button">. If replaced, the control will not work correctly.

    Although not a straightforward one, a workaround is to just hide the buttons (via style.display="none") and add the links. Here is some more information:

    You should attach an MS Ajax event handler to the link's onclick attribute instead of using the href attribute. The event handler can extract the li element (e.g. the row) by walking the parents of the event target. Walking all the li elements of the parent ul element you can find the index of the row. The event handler should then call RadUpload's deleteFileInputAt method to remove the row.

    Let me know if that helps.

    Kind regards,
    Erjan Gavalji
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Jeff
    Jeff avatar
    29 posts
    Member since:
    Nov 2006

    Posted 15 Aug 2008 Link to this post

    Thanks I will try this out on Monday and let you know how I get on.
Back to Top