open radasyncupload window onclick of a radbutton

10 posts, 0 answers
  1. beeta one
    beeta one avatar
    63 posts
    Member since:
    Aug 2012

    Posted 04 Oct 2012 Link to this post

    hii,,
    How to open radasyncupload window onclick of a radbutton??
    thnks
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 04 Oct 2012 Link to this post

    Hi,

    Try the following code snippet to achieve your scenario.

    ASPX:
    <telerik:RadButton runat="server" Text="SELECT" ID="button1" OnClientClicking="OnClientClicking">
    </telerik:RadButton>
    <telerik:RadAsyncUpload runat="server" ID="AsyncUpload1" Localization-Select="" MaxFileInputsCount="1" >
    </telerik:RadAsyncUpload>

    C#:
    <script type="text/javascript">
        function OnClientClicking(sender) {
            sender.set_autoPostBack(false);
            $telerik.$(".ruFileInput").click();
        }
    </script>

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Plamen
    Admin
    Plamen avatar
    2729 posts

    Posted 08 Oct 2012 Link to this post

    Hi Hash, 

     
    Please have in mind that such behavior will not work in all browsers(like IE for example) because of Browser security limitations. Here is a related forum thread.

    Regards,
    Plamen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  5. Heera
    Heera avatar
    10 posts
    Member since:
    Dec 2011

    Posted 03 Jun 2014 Link to this post

    When more than one telerik:RadAsyncUpload control then how to find AsyncUpload1 or AsyncUpload2 in javascript.

    ASPX:
    <telerik:RadButton runat="server" Text="SELECT" ID="button1"OnClientClicking="OnClientClicking"></telerik:RadButton><telerik:RadAsyncUpload runat="server" ID="AsyncUpload1" Localization-Select="" MaxFileInputsCount="1" ></telerik:RadAsyncUpload>
    <telerik:RadAsyncUpload runat="server" ID="AsyncUpload2" Localization-Select="" MaxFileInputsCount="1" ></telerik:RadAsyncUpload>
    C#:
    <script type="text/javascript">    function OnClientClicking(sender) {        sender.set_autoPostBack(false);        $telerik.$(".ruFileInput").click();    }</script>
  6. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 04 Jun 2014 in reply to Heera Link to this post

    Hi Heera,

    In order to uniquely identify the RadAsyncUpload you can use id of the control as follows.

    JavaScript:
    function OnClientClicking(sender) {
        sender.set_autoPostBack(false);
        $telerik.$("#AsyncUpload1file0").click();
    }

    Thanks,
    Shinu.
  7. Heera
    Heera avatar
    10 posts
    Member since:
    Dec 2011

    Posted 06 Jun 2014 in reply to Shinu Link to this post

    Problems
    1. this method only one file selection not a multiple file
    2. if i select a file after selection, I remove file from control and reclick on button then rad asynupload not work.
  8. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 10 Jun 2014 in reply to Heera Link to this post

    Hi Heera,

    Please do the following modification in the above posted code which works fine at my end.

    ASPX:
    <telerik:RadAsyncUpload runat="server" ID="AsyncUpload1" Localization-Select="" CssClass="RadAsyncUpload1" MultipleFileSelection="Automatic">
    </telerik:RadAsyncUpload>

    JavaScript:
    function OnClientClicking(sender) {
        sender.set_autoPostBack(false);
        $telerik.$(".RadAsyncUpload1 .ruFileInput").click();
    }

    Thanks,
    Shinu.
  9. Heera
    Heera avatar
    10 posts
    Member since:
    Dec 2011

    Posted 07 Jul 2014 in reply to Shinu Link to this post

    It is working.............

    Thank you so much.

  10. Rob Dismaya
    Rob Dismaya avatar
    9 posts
    Member since:
    May 2007

    Posted 29 Jan 2015 Link to this post

    Has anybody been able to come up with a work around for browsers that are <IE10? I can't seem to get the file input field to open from javascript. Thanks.
  11. Plamen
    Admin
    Plamen avatar
    2729 posts

    Posted 01 Feb 2015 Link to this post

    Hi,

    This is a browser security limitation.

    Hope this will explain the issue.

    Regards,
    Plamen
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017