Client Callbacks And Event Handlers

P

pbd22

Hi There.

I think i need some software design help.

I have a page, server.aspx, that starts uploading video files when it
is loaded via hidden iframe by the client. On the same page is an
event handler (below) that produces useful data about the upload
(percent, time, bytes, etc).

MY PROBLEM is that the server.aspx file is being used for video
uploads and I need to create a second polling routine on the client
that polls upload data provided by the onIncrementCallback method. I
can't call server.aspx twice (for two different purposes) in my client-
side querystring.

How do i query the info provided by the event handler when the same
page is being used for video uploads?

Thanks!

___________________________________________________

Public Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Me.Load

For iFile = 0 To uploadFiles.Count - 1

Dim workThread As New Thread(New ThreadStart(AddressOf upload.doWork))
Dim postedFile As HttpPostedFile = uploadFiles(iFile)
upload.FileName = postedFile.FileName
AddHandler upload.Incremented, AddressOf
onIncrementCallback
If Not postedFile.FileName.Equals("") Then
workThread.Start()
upload.UploadFile(postedFile.FileName)
workThread.Join()
End If

RemoveHandler upload.Incremented, AddressOf
onIncrementCallback
Next iFile
End Sub

Public Sub onIncrementCallback(ByVal sender As Object, ByVal e As
IncrementEventArgs)

' DATA SUCH AS e.Progress, e.TotalBytes, e.CurrentBytes, e.Time ETC IS
DYNAMICALLY UPDATED AND MADE AVAILABLE HERE.

End Sub
 
G

Guest

How do i query the info provided by the event handler when the same
page is being used for video uploads?

You need to do this through asynchronous javascript ... with Ajax or a
second iframe reloading the server.aspx page.
 
P

pbd22

You need to do this through asynchronous javascript ... with Ajax or a
second iframe reloading the server.aspx page.


THanks for your response.
I am doing that. Or, that was what I intended.
I guess my question is - can I use the same
page for two different iframe (or ajax) RPC calls?
Server.aspx is used to upload the videos for the
first and return video upload information for the
second. Will two different calls targeting the same
page matter?
 
G

Guest

can I use the same
page for two different iframe (or ajax) RPC calls?
Server.aspx is used to upload the videos for the
first and return video upload information for the
second. Will two different calls targeting the same
page matter?

Each time a page is called in ASP.NET it is a new instance. So yes, you can
call it multiple times.

Of course you'll need to distinguish each different type of calls - which
can be done with query strings. Or you could create different pages - 1 for
polling and 1 for upload. There are many different ways of doing what you
intend.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top