This project has moved. For the latest updates, please go here.

pass a value from a non-autopostback dropdownlist to ashx not executed

Aug 23, 2009 at 2:57 AM

Hi Michael. I would pass a value to ashx.The problem is the javascript function "pluginLoaded(sender)"  is only loaded when the page is loaded. After the page and your control is loaded, if a user selected a value from a non-autopostback(for better user experience), the selected value can't be obtained, which means a value can't be passed to ashx dynamically.... If the dropdownlist is set autopostback with true, there is no problem since a postback surely triggers the page reloaded, and function "pluginLoaded(sender)" can be executed. But the problem is a better user experience is bad, and what's more the postback even makes the file list of the silverlight control disappears. I try to edit the javascript code like this:

1.Register slCtl.Content.Files.StartUpload = StartUpload in function pluginloaded.
2.Move the code "slCtl.Content.Files.CustomParams = document.getElementById("DropDownList1").value"  from PluginLoaded to function StartUpload.

But still file upload failed...why!

And another things I can not understand: Is the code "slCtl.Content.Files.CustomParams" in PluginLoaded function same as the property "CustomParam=yourparameters" in the silverlight control's property "InitParameters="HttpUploader=true,MaxFileSizeKB=,MaxUploads=2,FileFilter=,CustomParam=yourparameters,DefaultColor=White". If that is why one is "CustomParams" and another is "CustomParam"? This "s" difference is a bug?

Aug 23, 2009 at 3:18 AM

I am almost there! But...

My mistake: I should not register an action of a button by :slCtl.Content.Files.StartUpload = StartUpload. Since this is an action of a button!

When I press the outside upload button other than the upload button in silverlight control, the value can be passed to ashx by the following:
//Actions
        function StartUpload() {
            if (slCtl != null) {
                slCtl.Content.Files.CustomParams = document.getElementById("DropDownList1").value;
                slCtl.Content.Control.StartUpload();
            }
        }

But the problem is  there are 2 upload buttons in the page ,one is outside one is inside of silverlight control. We could not know which one is pressed....And also the inside upload button can not pass a dynamic value to ashx since the Function PluginLoaded is only loaded when the page is loaded. I searched your file :JavascriptOnly_MultiFileUploadTestPage.html, no registed function can be used to pass a value just before a uploading operation starts....

How to pass values?...