or
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> </telerik:RadScriptManager> <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> <script type="text/javascript"> //<![CDATA[ function fileUploaded(sender, eventArgs) { var btn = $get("<%= Me.BTN_loadfile.ClientID%>"); if (typeof (btn) != "defined") { btn.disabled = false; } } //]]> </script> </telerik:RadCodeBlock> <telerik:RadProgressManager ID="RPM_importAdmin" runat="server" /> <br /> File to load administrators from (.CSV,.XLS, or .XLSX): <br /> <br /> <telerik:RadAsyncUpload ID="RAU_uploadFile" MaxFileInputsCount="1" MaxFileSize="10485760" InputSize="60" AllowedFileExtensions="csv,xls,xlsx" runat="server" OverwriteExistingFiles="true" OnClientFileUploaded="fileUploaded" > <Localization Select="Browse" /> </telerik:RadAsyncUpload> <br /> <br /> <telerik:RadProgressArea ID="RPA_uploadFile" DisplayCancelButton="true" runat="server"> </telerik:RadProgressArea> <asp:Button ID="BTN_loadfile" runat="server" Text="Should Go" Enabled="false" CausesValidation="false" PostBackUrl="~/test2.aspx"></asp:Button> <asp:Button ID="Button1" runat="server" Text="Goes" CausesValidation="false" PostBackUrl="~/test2.aspx"></asp:Button> <br /> </form> </body> </html>
Imports System.IO Imports Telerik.Web.UI Partial Class test2 Inherits System.Web.UI.Page Protected fileUploader As RadAsyncUpload = Nothing Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit If PreviousPage Is Nothing Then If Not IsPostBack Then Me.Label1.Text = "no previous page" End If Else Me.fileUploader = CType(PreviousPage.Form.FindControl("RAU_uploadFile"), RadAsyncUpload) If Me.fileUploader IsNot Nothing AndAlso Me.fileUploader.UploadedFiles.Count > 0 Then Me.Label1.Text = "File: " & Path.Combine(Me.fileUploader.TargetFolder, Me.fileUploader.UploadedFiles(0).FileName) End If End If End Sub End Class<telerik:RadAsyncUpload runat="server" ID="FilesToUpload" MultipleFileSelection="Automatic" HttpHandlerUrl="~/Tracking/FileUpload.ashx" AutoAddFileInputs="true" />public class CustomConfiguration : AsyncUploadConfiguration{ public string UserName { get; set; } public long FileNoteID { get; set; } public bool SaveContentOnly { get; set; }}public partial class UploadFiles{ protected override void OnInit(EventArgs e) { base.OnInit(e);CustomConfiguration config = FilesToUpload.CreateDefaultUploadConfiguration<CustomConfiguration>(); config.FileNoteID = 1234; // sample ID config.UserName = "michael"; // sample user name config.SaveContentOnly = true; FilesToUpload.UploadConfiguration = config; }}public class FileUpload : AsyncUploadHandler{ protected override IAsyncUploadResult Process(UploadedFile file, HttpContext context, IAsyncUploadConfiguration configuration, string tempFileName) { CustomConfiguration config = configuration as CustomConfiguration; if (config != null) { // UserName & FileNoteID come through as "" and 0 with latest release. DoSomething(config.UserName, Config.FileNoteID); } }}