Reputation: 31
I have RadAsyncUpload on my Webpage and Two Button . Button1 and Button2
The problem is that RadAsyncUpload is Uploading file on both button click i want it just upload file on Button1 Click ,
Below is the Design Code
<div>
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
</div>
<telerik:RadAjaxLoadingPanel
ID="RadAjaxLoadingPanel1" Runat="server" MinDisplayTime="2000" Skin="Default">
</telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
</telerik:RadAjaxManager>
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" height="200px"
HorizontalAlign="NotSet" LoadingPanelID="RadAjaxLoadingPanel1" width="300px">
<telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server"
MultipleFileSelection="Automatic"
UploadedFilesRendering="BelowFileInput">
</telerik:RadAsyncUpload>
<asp:Button ID="Button1" runat="server" Text="Button1" />
<asp:Button ID="Button2" runat="server" Text="Button" />
</telerik:RadAjaxPanel>
AND MY VB.NET CODE :
Imports Telerik.Web.UI
Imports System.IO
Partial Class Default2
Inherits System.Web.UI.Page
Protected Sub RadAsyncUpload1_FileUploaded(ByVal sender As Object, ByVal e As Telerik.Web.UI.FileUploadedEventArgs) Handles RadAsyncUpload1.FileUploaded
Const relativePath As String = "~/Uploads/"
Dim filename = e.File.FileName
'Dim parentID = Convert.ToInt32(GridView1.SelectedValue)
Dim filesize = Convert.ToInt32(e.File.ContentLength)
Dim physicalSavePath = MapPath(relativePath) + filename
'Store file info in database
'Dim app_FilesAdapter = New app_FilesTableAdapter()
'app_FilesAdapter.Insert(filename, relativePath & Convert.ToString(filename), parentID, 1, DateTime.Now, filesize)
'Save physical file on disk
e.File.SaveAs(physicalSavePath, True)
End Sub
End Class
Upvotes: 0
Views: 1460
Reputation: 31
Just use the PostbackTriggers="Button1" property of RadAsyncUpload
Thanks !!
Upvotes: 2