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?
<telerik:RadUpload
ID="RadUpload1" runat="server"
MaxFileInputsCount="5"
TargetFolder="~/Upload/Examples/UsingTargetFolder/MyFiles"
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
repeaterResults.DataBind()
labelNoResults.Visible = False
repeaterResults.Visible = True
Else
labelNoResults.Visible = True
repeaterResults.Visible = False
End If
DeleteFiles()
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
file.SaveAs(targetFileName)
End Sub
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?
<telerik:RadUpload
ID="RadUpload1" runat="server"
MaxFileInputsCount="5"
TargetFolder="~/Upload/Examples/UsingTargetFolder/MyFiles"
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
repeaterResults.DataBind()
labelNoResults.Visible = False
repeaterResults.Visible = True
Else
labelNoResults.Visible = True
repeaterResults.Visible = False
End If
DeleteFiles()
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
file.SaveAs(targetFileName)
End Sub