Posted
on Jan 21, 2008
(permalink)
Hello,
Thanks for the tip, it works well. I, now, have a different problem related to the script you have sent, here is the situation (a bit long):
All the pages of the website derive from one master page. On the pages that use the RadUpload control, I have placed multiview controls to show/hide the RadUpload controls depending on user clicks. I have placed the script you sent in the master page code so that it would be present in all the pages. This works fine when the RadUpload controls are displayed in the page, however I get a javascript error when no RadUpload control is there. This is to say that when the multiview control's index is set to show the view where the RadUpload control is located, everything is fine, but when the view index is not at a view that contrains any RadUpload controls, the javascript error occurs. The error says that RadUploadNameSpace is not defined and this is understandable if no RadUpload control code is generated by the server in the HTML page. To remedy this problem, I thought that the best way is to inject the script in the page code only when the RadUpload controls will be shown. For that, I have used the ClientScript.RegisterClientScriptBlock(...) method.
The results I got are not exactly what I expected. When no RadUpload controls were displayed on the page, the script was not injected, which is what I want; but then, when the RadUpload controls were to be displayed, I got the same javascript error. I checked the source of the page and saw that the script I injected is there.
So my question is now, why is there an error?? A guess would be that the location of the script in the page is not the same, could that be a source of error? When I use the RegisterClientScriptBlock method, the script is placed before the RadUpload controls code, while when the script used to be in the master page, it was placed at the end of the document, after the /body tag. If this positioning is the source of error, could you please tell me if there is a way to inject code at the end of the page? or at least after the RadUpload controls have been declared?
Thank you for your help.