Create a Dedicated Submit Button for RAD Upload

Thread is closed for posting
6 posts, 0 answers
  1. Hassan Yasir
    Hassan Yasir avatar
    11 posts
    Member since:
    Apr 2010

    Posted 23 Apr 2010 Link to this post

    As mentioned in Telerik Documentation, it's upload control re-acts on postback. Here some users are concerned, that RAD Upload control fires its submit event, when they click to other button or any control which postback on the web form.

    Related to this, Telerik online documentation also has got a solution (How to Prevent Upload). After revising those codes, I have modified it little and written codes in a way that users can easily achieve the target.

    Javascript:
        <script type="text/javascript"
     
            function onClientSubmitting(progressManager, args) { 
                var eventTarget = document.getElementById('__EVENTTARGET'); 
                if (eventTarget.value == '<%= ButtonUpload.UniqueID %>') { } else { 
                var upload = $find("<%= RadUpload1.ClientID %>"); 
                var fileInputs = upload.getFileInputs(); 
                for (var i = 0; i < fileInputs.length; i++) { 
                    upload.clearFileInputAt(i); 
                } 
                } 
            } 
             
        </script> 
    Note: ButtonUpload is a LinkButton; Upload must be start when the ButtonUpload is fired.

    In the .aspx
      <telerik:RadProgressManager id="Radprogressmanager1" runat="server" OnClientSubmitting = "onClientSubmitting" /> 
        <telerik:RadUpload ID="RadUpload1" runat="server" TargetFolder="uploads"  
            ControlObjectsVisibility="None" Height="25px" MaxFileInputsCount="1" Width="214px"  
           > 
        </telerik:RadUpload> 
        <telerik:RadProgressArea ID="RadProgressArea1" runat="server" Language=""  
            DisplayCancelButton="True"
    <Localization Uploaded="Uploaded"></Localization> 
        </telerik:RadProgressArea> 
      
        <br /> 
      <asp:LinkButton runat="server" id="ButtonUpload" text="Upload" /> 
    Note: Make sure to provide the onClientSubmitting method to RadProgressManager

    Excluding to this topic: Some users very often complain that RadProgressArea does not work while uploading. And regarding to my experience it happens when your Application's Trust level is medium.

    You can adjust it by writing these codes in web.config:
    <system.web> 
        <trust level="Full" /> 
    </system.web> 

    Thank You

    Regards,
    Tekie



  2. Majid Darab
    Majid Darab avatar
    110 posts
    Member since:
    Sep 2012

    Posted 24 May 2010 Link to this post

    Hi My Dear Friend :
    I Test Your Code And

    var eventTarget = document.getElementById('__EVENTTARGET');

    always empty for buttons - but it works for radcomboboxes with auto postback = true
    ========================================================================
    i refered to this thread because after upload my web site to a host when u are in a page that contains radupload and radprogress area , when u click any button radprogress area appears ... whether radupload be empty or not...

    what can i do to fix this problem ?
    how can i tell to radupload have a private submit button?
    is using the upper code good idea for solve this problem or not?

    thanks for your future advise



  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Hassan Yasir
    Hassan Yasir avatar
    11 posts
    Member since:
    Apr 2010

    Posted 26 May 2010 Link to this post

    Hello Majid,
    One thing I would like to know is whether you're using an ASP:Button as an Upload Button?
    If that is the case, you won't be able to reach the goal.

    Try to use Linkbutton as your private upload button, and set it's ID as "ButtonUpload"
    That's how it works!

    If you can't achieve your goal, post your sample codes. I will review and can give you a example.

    Thanks
  5. Majid Darab
    Majid Darab avatar
    110 posts
    Member since:
    Sep 2012

    Posted 26 May 2010 Link to this post

    hi Hassan Yasir
    imagine that i have a content page that related to a master page...
    in that content page i have a multiview and in one of those views i have a table for inputing data...(with radupload and 3 buttons for saving data in different conditions)
    beside that radupload i have a LINKBUTTON (as u said) for saving my pix...and i do not want any of the other buttons for saving pix.
    sometimes when u click on one of those 3 buttons for saving data RADPROGRESSAREA ppears for a second and this happens even no pic is selected in radupload...
    so i refered to this thread to set a dedicate button for my RadUpload...
    the upper code only  recognizes radcomboboxes(with AutoPostBack = True) and checkboxes (with AutoPostBack = True)
    but about butons and link buttons it's eventTarget Is null ... i test it by alert
    ====================================================================================================
    i set use submit behaviour for those buttons to false -> not help
    i have many validators on that table and i can not disable CausesValidation of those buttons -> not help

    hope this help to give an advice to me

    best regards



  6. Hassan Yasir
    Hassan Yasir avatar
    11 posts
    Member since:
    Apr 2010

    Posted 01 Jun 2010 Link to this post

    Can u simply send me a sample in which you are causing that problem. So that I can fix the coding and send you back. I think it would take less time than discussing here.

    Thanks
  7. Alberto
    Alberto avatar
    6 posts
    Member since:
    Jun 2010

    Posted 08 Jul 2010 Link to this post

    this method dos not work for RadAsyncUpload.
    getFileInputs always returns empty!

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