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

Upload button trigger?

1 Answer 44 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Philip asked on 09 Sep 2009, 04:08 PM
I am trying to use the radupload control, and am having trouble connecting the "submit" button to the control.

After looking a the demos for this control, I can not see where the button is tied into the upload.

It would appear that the button click is simply toggling the visibility of labels and such.

How is the filexists fired? What controls it if I have multiple buttons in my page?

Obviously I am missing something here, any help would be greatly appreciated.

How does the code below trigger the file to be uploaded on the click of the button?

                            ID="RadUpload1" runat="server"
                            OverwriteExistingFiles="false" />

<asp:Button id="buttonSubmit" runat="server" CssClass="RadUploadSubmit" OnClick="buttonSubmit_Click" text="Submit" />

 Protected Sub buttonSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs)
            If RadUpload1.UploadedFiles.Count > 0 Then
                repeaterResults.DataSource = RadUpload1.UploadedFiles
                labelNoResults.Visible = False
                repeaterResults.Visible = True
                labelNoResults.Visible = True
                repeaterResults.Visible = False
            End If
        End Sub

Protected Sub RadUpload1_FileExists(ByVal sender As Object, ByVal e As Telerik.Web.UI.Upload.UploadedFileEventArgs)
            Dim counter As Integer = 1
            Dim file As UploadedFile = e.UploadedFile
            Dim targetFolder As String = Server.MapPath(RadUpload1.TargetFolder)
            Dim targetFileName As String = Path.Combine(targetFolder, file.GetNameWithoutExtension() + counter.ToString() + file.GetExtension())
            While System.IO.File.Exists(targetFileName)
                System.Math.Max(System.Threading.Interlocked.Increment(counter),counter - 1)
                targetFileName = Path.Combine(targetFolder, file.GetNameWithoutExtension() + counter.ToString() + file.GetExtension())
            End While
        End Sub

1 Answer, 1 is accepted

Sort by
Veselin Vasilev
Telerik team
answered on 10 Sep 2009, 08:55 AM
Hello Philip,

Actually, RadUpload is not connected with any submit button. It is uploading with postbacks triggered by any control (that can postback).
You can check this help topic on how to upload a file if only a particular button is clicked.

Best wishes,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Upload (Obsolete)
Asked by
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Share this question