Most of the web applications nowadays prefer to be an AJAX enabled application. Ajax enabled applications is basically eliminates those annoying flickers occurred when a page is refreshed. This articles shows on how we are going make our webparts to be an ajax enabled one.
Most of the web applications nowadays prefer to be an
This articles shows on how we are going make our webparts to be an
Below are the steps in creating an
Figure A
Figure B
Figure C
As what you have noticed, you can drag and drop a webpart only once and if you would try to drag it again it will just highlight the header of the webpart that you are trying to drag. Basically by default, webparts do not support updatepanel control but they provide a workaround on how to move webparts and supported in updatepanel control.
The Problem
ASP.NET Web Parts Drag and Drop feature and Drop down verbs menu does not operate correctly inside of a Microsoft AJAX 1.0 UpdatePanel.
Why it 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.
The Workaround
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
Figure D
Figure E
AjaxEnabledWebpart.zip– I attached the dll together with this file
<configuration>system.web><pages> <tagMapping>
<add tagType="System.Web.UI.WebControls.WebParts.WebPartManager" mappedTagType="Sample.Web.UI.WebParts.WebPartManager, Sample.Web.UI.WebParts"/> </tagMapping> </pages> </system.web></configuration>
Figure F
As what you have notice now, you can drag and drop webparts in different zones without flicker or without refreshes the entire page.
About the Author: