How to Raise Events for FILEUPLOAD Control

ASP.NET is an open-source, server-side web application framework designed for web development to produce dynamic web pages. Microsoft developed it to allow programmers to build active websites, applications and services. Wikipedia

This post will show you a straightforward trick to raise the event of ASP.NET file upload control. Check out the following code snippets; it is straightforward to understand

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="EventFileUpload.aspx.cs"
   Inherits="EventFileUpload" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="">
<head runat="server">

   <script type="text/javascript">
function GetFileName(val)
   var i = val.lastIndexOf("\\");
   return val.substring(i+1);

   <title>Untitled Page</title>
   <form id="form1" runat="server">
           <asp:FileUpload ID="FileUpload1" runat="server" size="40"
onchange="this.form.TextBox1.value=GetFileName(this.value);" />
           <asp:TextBox ID="TextBox1" runat="server" />
Next Post Previous Post
No Comment
Add Comment
comment url