Some of you will be pleased to know that I have produced a workaround to address the issue of WebPart Drag and Drop (and verb popup menus) not operating correctly inside of an update panel.
It seems that the
functionality being shown off on channel 9 (using Ajax CTP) was only to tease us into thinking that this would be possible in Ajax 1.0 (the final release).
Here are the details of the work around:
AJAX 1.0 Compatible WebPartManager (Workaround)
1. The Problem
ASP.NET Web Parts Drag and Drop facility and Drop down verbs menu does not operate correctly inside of an Microsoft AJAX 1.0 UpdatePanel.
2. Why is doesn't work
The WebPartManager is responsible for registering an include and start up script. This script provides Web Parts and zones with various client side functionality including drag and drop and drop down verb menus.
When a control is placed inside of an Update Panel, the script is rendered and ran on the first render, but not on subsequent renders. Due to this, the client side functionality fails.
3. The Solution
The solution is simple. Inherit the WebPartManager, override the RenderClientScript Method and render the client scripts using the System.Web.UI.ScriptManager instead of the System.Web.UI.ClientScriptManager. The System.Web.UI.ScriptManager informs Ajax
of the registered client scripts and ensures that they are rendered out and executed whenever an UpdatePanel is refreshed.
iv. Use Web Parts as normal (There is no need to replace the System.Web.UI.WebControls.WebParts.WebPartManager with Sample.Web.UI.WebParts.WebPartManager as the above mapping will take care of this).
Enjoy! [:D]
David
Atlas WebPartsWebPartsWebPartManagerWebPartweb 2.0webpart space drag drop
I haven't tried it, but I am aware that the same problem exists with the
Microsoft.Web.Preview.UI.Controls.WebParts.WebPartManager in Microsoft.Web.Preview.
I'm sure the fix would work using this control (just change the class being inherited and the tag mapping), although I'm not sure why you would want to do this (or why they even included this control in the Futures release considering it doesnt work!??).
Thanks so much for figuring this one out. Since I have been put on the spot for our future "Webbish awareness" which includes portals
and minimal postbacks I am sure this would have been an enormous woe for me very soon.
Thanks,
Joe Johnston
If a picture is worth a 1000 words, a sample application is worth a 1000 blog entries
I use Microsoft.Web.Preview.UI.Controls.WebParts.WebPartManager
for Drag and Drop support in FireFox so I would like to know if this workaround can apply to Microsoft.Web.Preview.UI.Controls.WebParts.WebPartManager.
Does the WebpartManager need to be in the same UpdatePanel as the WebpartZone for this to work? I want to have one WebpartManager on the page and serveral TabPanels each containing an UpdatePanel that contains WebPartZones in various layouts. Is it posssible
to render more than one update panel at a time so that I am always rendering the WebpartManager's UpdatePanel?
Also this seem like a pretty easy fix - almost too good to be true - is there a reason MS dropped this funtionality from AJAX and the CTP?
I use Microsoft.Web.Preview.UI.Controls.WebParts.WebPartManager
for Drag and Drop support in FireFox so I would like to know if this workaround can apply to Microsoft.Web.Preview.UI.Controls.WebParts.WebPartManager.
Hi spvlong,
I have done some investigation on this component and have found that for this workaround to work you would probably need to also update the include script for it to operate correctly with
Microsoft.Web.Preview.UI.Controls.WebParts.WebPartManager.
My guess is that the only differance between the normal WebPartManager and the one found in
Microsoft.Web.Preview.UI.Controls.WebParts.WebPartManager is the include script. Based on this in order to get this workaround to work with the
Microsoft.Web.Preview.UI.Controls.WebParts.WebPartManager. you would need to do the following:
In the WebPartManager in my project change the class being inherited from the standard WebPartManager to
Microsoft.Web.Preview.UI.Controls.WebParts.WebPartManager.
Replace the embeded WebPartManager.js file in my project with the one emitted from the
Microsoft.Web.Preview.UI.Controls.WebParts.WebPartManager (it is currently a copy of the one emmitted from the standard WebPartManager).
Change the tag mapping to map from the Microsoft.Web.Preview.UI.Controls.WebParts.WebPartManager
to the workaround WebPartManager
In your web project use the Microsoft.Web.Preview.UI.Controls.WebParts.WebPartManager (and WebPartZones)
If this does not work my guess would be that the dynamically generated inline script being emitted from the futures WebPartManager is also differant to that of the standard WebPartManager. In this case this inline script would also need to be updated to
match (I really don't think that this will be the case).
I will have a more detailed look into this if and when I get a chance.
I tried this solution and it appears to work fairly well for firefox, yet in IE I can only drag and drop a webpart once into another zone, then i cannot drag it into another zone anymore?
davior
Member
19 Points
11 Posts
Workaround for using Web Parts with AJAX 1.0 UpdatePanel
Mar 15, 2007 03:34 AM|LINK
Hi All,
Some of you will be pleased to know that I have produced a workaround to address the issue of WebPart Drag and Drop (and verb popup menus) not operating correctly inside of an update panel.
It seems that the functionality being shown off on channel 9 (using Ajax CTP) was only to tease us into thinking that this would be possible in Ajax 1.0 (the final release).
Here are the details of the work around:
AJAX 1.0 Compatible WebPartManager (Workaround)
1. The Problem
ASP.NET Web Parts Drag and Drop facility and Drop down verbs menu does not operate correctly inside of an Microsoft AJAX 1.0 UpdatePanel.
2. Why is doesn't work
The WebPartManager is responsible for registering an include and start up script. This script provides Web Parts and zones with various client side functionality including drag and drop and drop down verb menus.
When a control is placed inside of an Update Panel, the script is rendered and ran on the first render, but not on subsequent renders. Due to this, the client side functionality fails.
3. The Solution
The solution is simple. Inherit the WebPartManager, override the RenderClientScript Method and render the client scripts using the System.Web.UI.ScriptManager instead of the System.Web.UI.ClientScriptManager. The System.Web.UI.ScriptManager informs Ajax of the registered client scripts and ensures that they are rendered out and executed whenever an UpdatePanel is refreshed.
4. Using the AJAX 1.0 Compatible WebPartManager
i. Download the Solution (includes source code)
ii. Compile the project and add a reference to it in your web project.
iii. Add the following Tag Mapping to the specified section of your web.config:
iv. Use Web Parts as normal (There is no need to replace the System.Web.UI.WebControls.WebParts.WebPartManager with Sample.Web.UI.WebParts.WebPartManager as the above mapping will take care of this).
Enjoy! [:D]
David
Atlas WebParts WebParts WebPartManager WebPart web 2.0 webpart space drag drop
spvlong
Participant
1025 Points
187 Posts
Re: Workaround for using Web Parts with AJAX 1.0 UpdatePanel
Mar 15, 2007 06:27 AM|LINK
Hi davior,
That sounds great. Have you tried this workaround for the WebPartManager in ASP.Net AJAX Futures?
Regards.
The Vietnamese Stock Market and Economy
davior
Member
19 Points
11 Posts
Re: Workaround for using Web Parts with AJAX 1.0 UpdatePanel
Mar 16, 2007 12:22 AM|LINK
Hi spvlong,
I haven't tried it, but I am aware that the same problem exists with the Microsoft.Web.Preview.UI.Controls.WebParts.WebPartManager in Microsoft.Web.Preview.
I'm sure the fix would work using this control (just change the class being inherited and the tag mapping), although I'm not sure why you would want to do this (or why they even included this control in the Futures release considering it doesnt work!??).
Cheers
David
khaos
Contributor
2855 Points
690 Posts
Re: Workaround for using Web Parts with AJAX 1.0 UpdatePanel
Mar 16, 2007 01:02 AM|LINK
Thanks so much for figuring this one out. Since I have been put on the spot for our future "Webbish awareness" which includes portals and minimal postbacks I am sure this would have been an enormous woe for me very soon.
Thanks,
If a picture is worth a 1000 words, a sample application is worth a 1000 blog entries
Remember the Constitution!
Dont forget to mark posts answered and resolved (if they are)
spvlong
Participant
1025 Points
187 Posts
Re: Workaround for using Web Parts with AJAX 1.0 UpdatePanel
Mar 16, 2007 02:42 AM|LINK
Hi David,
I use Microsoft.Web.Preview.UI.Controls.WebParts.WebPartManager for Drag and Drop support in FireFox so I would like to know if this workaround can apply to Microsoft.Web.Preview.UI.Controls.WebParts.WebPartManager.
Thanks,
The Vietnamese Stock Market and Economy
Nick Coleman
Member
6 Points
5 Posts
Re: Workaround for using Web Parts with AJAX 1.0 UpdatePanel
Mar 16, 2007 06:01 AM|LINK
Does the WebpartManager need to be in the same UpdatePanel as the WebpartZone for this to work? I want to have one WebpartManager on the page and serveral TabPanels each containing an UpdatePanel that contains WebPartZones in various layouts. Is it posssible to render more than one update panel at a time so that I am always rendering the WebpartManager's UpdatePanel?
Also this seem like a pretty easy fix - almost too good to be true - is there a reason MS dropped this funtionality from AJAX and the CTP?
davior
Member
19 Points
11 Posts
Re: Workaround for using Web Parts with AJAX 1.0 UpdatePanel
Mar 17, 2007 04:16 AM|LINK
Hi spvlong,
I have done some investigation on this component and have found that for this workaround to work you would probably need to also update the include script for it to operate correctly with Microsoft.Web.Preview.UI.Controls.WebParts.WebPartManager.
My guess is that the only differance between the normal WebPartManager and the one found in Microsoft.Web.Preview.UI.Controls.WebParts.WebPartManager is the include script. Based on this in order to get this workaround to work with the Microsoft.Web.Preview.UI.Controls.WebParts.WebPartManager. you would need to do the following:
If this does not work my guess would be that the dynamically generated inline script being emitted from the futures WebPartManager is also differant to that of the standard WebPartManager. In this case this inline script would also need to be updated to match (I really don't think that this will be the case).
I will have a more detailed look into this if and when I get a chance.
Cheers
David
matt_cyr
Member
415 Points
85 Posts
Re: Workaround for using Web Parts with AJAX 1.0 UpdatePanel
Mar 19, 2007 05:09 PM|LINK
I tried this solution and it appears to work fairly well for firefox, yet in IE I can only drag and drop a webpart once into another zone, then i cannot drag it into another zone anymore?
Would you know any reason why this would happen?
azammitt
Member
139 Points
50 Posts
Re: Workaround for using Web Parts with AJAX 1.0 UpdatePanel
Mar 20, 2007 12:32 PM|LINK
http://www.magicajax.net/
Using the magic ajax update panel requires no work around and works great for using ajax with your webpart page.
davior
Member
19 Points
11 Posts
Re: Workaround for using Web Parts with AJAX 1.0 UpdatePanel
Mar 21, 2007 03:35 AM|LINK
Are you using the solution I linked to in the first post in this tread?
Have you made any changes to this?
If you are using the solution linked to in the first post, then i would imagine that it should work in IE and not in Firefox.
Have you followed the instructions in the readme of the project? Tag mappings etc.?
My guess is, that the webpart manager you are using is the standard one and not the modified one provided...
Cheers
David