Hi, I have added a handler in
Page_Init event like this:
Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
'MyBase.OnInit(e)
AddHandler Uploader1.FileUploaded, AddressOf Uploader_FileUploaded
End Sub
I debugged but Uploader_FileUploaded function does not executed, any idea why this happens?
Here is my entire code:
<CuteWebUI:UploadAttachments runat="server" ManualStartUpload="true" ID="Uploader1"
InsertText="Browse Files (Max 1M)" >
<VALIDATEOPTION MaxSizeKB="1024" />
</CuteWebUI:UploadAttachments>
<br />
<br />
<asp:Button runat="server" ID="SubmitButton" OnClick="SubmitButton_Click" OnClientClick="return submitbutton_click()" Text="Submit" />
<br />
<br />
<div>
<asp:ListBox runat="server" ID="ListBoxEvents" Width="400"></asp:ListBox>
</div>
<br />
<br />
<asp:Button ID="ButtonPostBack" Text="This is a PostBack button" runat="server" />
Protected Sub InsertMsg(ByVal msg As String)
ListBoxEvents.Items.Insert(0, msg)
ListBoxEvents.SelectedIndex = 0
End Sub
Protected Sub ButtonPostBack_Click(ByVal sender As Object, ByVal e As EventArgs)
InsertMsg(
"You clicked a PostBack Button.")
End Sub
Protected Sub SubmitButton_Click(ByVal sender As Object, ByVal e As EventArgs)
InsertMsg(
"You clicked the Submit Button.")
InsertMsg(
"You have uploaded " & uploadcount & "/" & Uploader1.Items.Count & " files.")
End Sub
Protected Sub Uploader_FileUploaded(ByVal sender As Object, ByVal args As UploaderEventArgs)
uploadcount += 1
Dim uploader As CuteWebUI.Uploader = DirectCast(sender, CuteWebUI.Uploader)
InsertMsg(
"File uploaded! " & args.FileName & ", " & args.FileSize & " bytes.")
'Copys the uploaded file to a new location.
args.CopyTo(Session(
"CurrentPath").ToString)
End Sub
Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
SubmitButton.Attributes(
"itemcount") = Uploader1.Items.Count.ToString()
lblUploadPath.Text = Session(
"CurrentPath").ToString
updpnlUpload.Update()
End Sub
Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
'MyBase.OnInit(e)
AddHandler Uploader1.FileUploaded, AddressOf Uploader_FileUploaded
AddHandler ButtonPostBack.Click, AddressOf ButtonPostBack_Click
End Sub