Upload Control, Use Image button as trigger

Thread is closed for posting
3 posts, 0 answers
  1. Thomas Maxwell
    Thomas Maxwell avatar
    10 posts
    Member since:
    May 2010

    Posted 24 Aug 2011 Link to this post

    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. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 25 Aug 2011 Link to this post

    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.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 29 Aug 2011 Link to this post

    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 >>

Back to Top