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

Upload Control, Use Image button as trigger

2 Answers 141 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Thomas Maxwell
Top achievements
Rank 1
Thomas Maxwell asked on 25 Aug 2011, 02:22 AM
Hi,

I am trying to get this to work with no luck.

I have a form where users can upload many small images and I need to know which image is what, an example might be:

it has 3 radupload controls on it.

upSmallIcon
UpMedIcon
upLargeIcon

I need each one to know which db field it represents...

the form has precious little space, so what I would like to do is have an image button which might have the existing image file set to it's image url so all the user would see is the image button, when they click the image button the select file dialog appears, the user can select the file and I take it from there.

I saw this in another post.

 

 

<script type="text/javascript">

 

 

 

var $fileInput;

 

 

 

function onClientAdded(sender, args) {

 

$fileInput = $telerik.$(args._fileInputField);

}

 

 

function OpenDialog() {

 

$fileInput.click();

}

 

 

</script>

 


This code however does not work if the radupload visible is set to false. I do not want the upload control itself to be visible, just the image button. Also obviously if there was a way to use a single control that would be great as well.

Any and all help would be greatly appreciated because this app I am working on has this type of thing all over the place in it.

Thanks ahead of time.

2 Answers, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 2
answered on 25 Aug 2011, 01:26 PM
Hello Thomas,

When you set a asp.net control's Visible="false", it does not render the control to the browser. You will need to set a style on the RadUpload to hide it. Like so:

<telerik:RadUpload ID="RadUpload1" runat="server" Style="display:none">
</telerik:RadUpload>

I hope that helps.

0
Dimitar Terziev
Telerik team
answered on 29 Aug 2011, 11:15 AM
Hi Kevin,

In case you want to hide the input of the RadUpload control and only have the image button, please refer to the following help article.

Please have in mind that opening the file dialog using javascript is not supported by all browsers due to security reasons.

Best wishes,
Dimitar Terziev
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Upload (Obsolete)
Asked by
Thomas Maxwell
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 2
Dimitar Terziev
Telerik team
Share this question
or