Pass variable to server code

Dec 20, 2010 at 8:55 PM
Edited Dec 20, 2010 at 9:04 PM

Hello everyone,

I have such problem - cannot send variable from javascript to server code.

I'm using DirectAmazonUploader to upload files, and for some reason i need to pass custom parameters from client code to server code, but i cannot do this.

My FileUploader is located inside UpdatePanel.

I tried to use setStateVariable in javascript

 

 <script type="text/javascript">
   <%= FileUploader.ClientID %>.setStateVariable("MyKey1", "MyValue1");
</script>

and then access this variable from the Form collection of the Request object inside FileUploader_ConfirmUpload handler, however no luck.

protected void FileUploader_ConfirmUpload(object sender, ConfirmUploadEventArgs e)
{
    string myKey1 = HttpContext.Current.Request.Form["MyKey1"];
}

I have a suspicion that it does not work because FileUploader is inside UpadePanel.

Please, help me to set StateVariable or to change ConfirmUploadEventArgs, or whatever that can help me to send a variable to server code.

Thanks in advance 

Jan 5, 2011 at 9:09 PM

Does anybody could help me?