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

Image Not Selected In Image Manager After Upload Using Custom Provider

4 Answers 93 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Phil
Top achievements
Rank 1
Phil asked on 04 Jan 2011, 03:43 PM
Hi

We've upgraded to the ASP.NET AJAX Q3 2010 release and in the demo scripts which ship with the this version the problem where an uploaded image was not immediately selected in the Image Manager dialog after it has been uploaded looks to have been fixed when using the standard image provider (i.e. files from disk).

Our project however uses a custom provider for the image manager and we are still seeing the issue (other than this problem our custom provider code works fine).  You can see the issue in the video below.  Note when uploading the first image everying is fine.  When uploading the second image the image manager is refreshed and looks as if it is about to show the newly uploaded image but then the entiure Image Manager windows is refreshed and the uploaded image is not pre-selected.

http://www.screencast.com/users/sbc2/folders/Default/media/45a50be2-88a5-40ab-9576-c963b5f69eb2

Is there something that we need to update in our custom provider code to fully implement the fix ?

Thanks

4 Answers, 1 is accepted

Sort by
0
Phil
Top achievements
Rank 1
answered on 04 Jan 2011, 04:15 PM
Hi again

Dont know if this helps but on using breakpoints in the code I can see that the ResolveDirectory()  method of our custom provider (which we override from your base provider) is called once when uploading my first image and then for the second and all subsequent image uploads it appears to be called twice (which may explain why the screen appears to reload after the 2nd upload).

Im assuming that there is an Ajax call somewhere which calls the ResolveDirectory() method from the Image Manager client but cannot see where.

cheers
0
Dobromir
Telerik team
answered on 06 Jan 2011, 04:50 PM
Hi Stephen,

This is indeed odd behavior of the RadFileExplorer.
To be able to provide more-to-the-point answer, however, we will need to examine the custom content provider. Could you please open a support ticket and provide a simple runnable project including the provider so we can debug it locally?

Regards,
Dobromir
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Phil
Top achievements
Rank 1
answered on 10 Jan 2011, 04:27 PM
Hi Dobromir

Ive tried putting together a simplified stand alone project which demonstrates the issue but unfortunately I cannot reproduce it in exactly the same way.

I have however managed to use Fiddler to view the requests/responses generated by the radEditor and have found the following pecularity.  If you look at the attached screenshot from fidder (which is the respones/requests as per my screencast) you can see that the first image upload generates a single call to DialogHandler.axd works fine (as in my screencast).  the image is uploaded and pre-selected in the Image Manager.

Fiddler Responses
On the second image upload you can see in the fiddler screenshot that 2 requests to DialogHander.axd are generated.  I've attached the raw exports from Fiddler for each of the 3 responses (links above) so you can see them.  Note that In the response #2 line 2085 the javascript code below is written out.  It looks to me as if this is what is casuing the unwanted 2nd postback.  What is generating this code ?

<script type="text/javascript">
//<![CDATA[
 
function GetRadWindow()
{
    if (window.radWindow)
    {
        return window.radWindow;
    }
    if (window.frameElement && window.frameElement.radWindow)
    {
        return window.frameElement.radWindow;
    }
    //If using classic windows (window.open)
    //Cache the reference, as a window can open a second window and the reference would be replaced.
    if (!window.__localRadEditorRadWindowReference && window.opener && window.opener.__getCurrentRadEditorRadWindowReference)
    {
        window.__localRadEditorRadWindowReference = window.opener.__getCurrentRadEditorRadWindowReference();
    }
    return window.__localRadEditorRadWindowReference;
}
 
var dialogParameters = GetRadWindow().DialogParameters;
document.getElementById('dialogParametersHolder').value = dialogParameters;
__doPostBack('__Page', '');
0
Lini
Telerik team
answered on 13 Jan 2011, 11:50 AM
Hi,

The JavaScript code that is in the second response is output when the dialog cannot find its dialog parameters in the URL (querystring). The dialog parameters contain the paths that should be displayed in the file explorer control and their permissions in encoded format. Since the length of the parameters can exceed the maximum allowed length for a URL (around 2000), we use an alternative approach that submits the dialog parameters as part of the page form and not through the URL. This happens with an additional postback and the code that does it is what you have pasted in your message. However, this should happen only once and that is when you first open the dialog. It should not happen when the dialog is refreshed (after uploading a file).

If this code is rendered after a postback, then one of two things has happened:

1. Something modified the URL of the dialog page and removed/changed the dialog parameters value there (if value was originally passed through querystring).
2. Something cleared the value of the hidden input field used to contain the dialog parameters (if value was originally passed through form value).

Unfortunately, the response code you have sent us does not tell us why the problem occurs - only why the page is refreshed after the second upload. You should either try to isolate the problem in a sample project or give us a complete fiddler session archive (.saz file). I am not sure that we'll be able to help only with the fiddler archive, but it is much better than the response, since it also contains the posted values on each request.

All the best,
Lini
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Editor
Asked by
Phil
Top achievements
Rank 1
Answers by
Phil
Top achievements
Rank 1
Dobromir
Telerik team
Lini
Telerik team
Share this question
or