Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Updating Textbox on File Upload

$
0
0

I have a AjaxFileUpload control on my page which successfully uploads file when its default upload button is clicked.

Later on, I thought of adding a textbox which would show the name of the file uploaded.

<asp:ScriptManager ID="ToolkitScriptManager1" runat="server"> </asp:ScriptManager><asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server"
        OnUploadComplete="AjaxFileUpload1_OnUploadComplete"
        MaximumNumberOfFiles="1"
        AllowedFileTypes="pdf"/><asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><asp:TextBox ID="FileTxtBox" runat="server" /></ContentTemplate></asp:UpdatePanel>

In codebehind,

protectedvoidAjaxFileUpload1_OnUploadComplete(object sender,AjaxFileUploadEventArgs file){string fileName =Path.GetFileNameWithoutExtension(file.FileName);FileTxtBox.Text= fileName;UpdatePanel1.Update();}

Do I need to do anything extra for the textbox to show the file? Please suggest.

Thank you


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>