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

Render button as links

2 Answers 88 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 15 Aug 2008, 11:38 AM
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 Answers, 1 is accepted

Sort by
0
Accepted
Erjan Gavalji
Telerik team
answered on 15 Aug 2008, 01:37 PM
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.
0
Jeff
Top achievements
Rank 1
answered on 15 Aug 2008, 02:33 PM
Thanks I will try this out on Monday and let you know how I get on.
Tags
Upload (Obsolete)
Asked by
Jeff
Top achievements
Rank 1
Answers by
Erjan Gavalji
Telerik team
Jeff
Top achievements
Rank 1
Share this question
or