This is a migrated thread and some comments may be shown as answers.

How can I send the whole asyncuploadcontrol to a webmethod for handling?

1 Answer 104 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Jeremy
Top achievements
Rank 1
Jeremy asked on 07 Apr 2012, 11:43 PM
My implementation prevents me from using the traditional OnFileUploaded event since there are several instances of this control and each needs to be tied to a ticketID that is contained in a hidden field. I was able to get a reference to the uploader object that is relevant to the button that fired the event like this:

$(".SubmitFiles").click(function () {
       var uplodrID = $(this).closest(".AddAttachment").find(".Uploader").attr("ID");
       var upldrObj = $find(uplodrID); //this is the telerik asyncupload control
   });

At least, I'm pretty sure it is because I can see all of the relevent settings and such inside of it during debug. Now, what I want to do is send this control into a webmethod in the page codebehind so that I can interate through all the files and send them to a database. I tried to do so like this:

PageMethods.ProcessUpload(upldrObj);

And of course I enabled pagemethods in the ScriptManager. What is happening is ...well nothing. The page doesn't throw and error, but its also  not showing that it is actually getting through to the webmethod. I set the webmethod to throw an exception if it ever got that far, but it never does. When I step through debug, the debug finishes before it ever gets to the webmethod:

[WebMethod()]
public static void ProcessUpload(RadAsyncUpload upld)
{
    throw new Exception("Stub");
}

Can anyone help? I'm sure I'm missing something minor

1 Answer, 1 is accepted

Sort by
0
Accepted
Genady Sergeev
Telerik team
answered on 12 Apr 2012, 08:24 AM
Hello Jeremy,

What you are trying to do is not possible. Page Methods are static and no instance of control can live there. You may want to check this article for more information.

 

Kind regards,
Genady Sergeev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
AsyncUpload
Asked by
Jeremy
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Share this question
or