1. Install Zone Tabs web part from http://code.msdn.microsoft.com/zonetabs/Release/ProjectReleases.aspx?ReleaseId=201
All credit goes to Bob German who developed this wonderful web part: http://blogs.msdn.com/bobgerman/archive/2008/02/19/back-in-the-zone-with-zonetabs.aspx
Installation steps:
a) Add Solution: (assuming you copy the .wsp file in C drive)
stsadm.exe –o addsolution –filename “C:\ EasyTabParts.wsp”
b) Deploy Solution:
stsadm.exe –o deploysolution –name “EasyTabParts.wsp” –url “http://sitecollectionurl” –allowgacdeployment –immediate
c)This feature has now been installed at your site collection specified
Activate this feature for your Site Collection.
Add this web part to any of your pages in web part zones i.e Left, Right, Middle, Bottom etc. (Note: you have to AJAXIFY this zone in the Page Layout, covered later in this article)
Works wonderfully well, but refreshes the whole page when you click on respective Tabs, our task is to make it AJAX driven, thereby causing only partial post-backs and not full page refreshes.
2. Download ASP.NET 2.0 AJAX extensions 1.0 from http://www.ajax.asp.net
3. Ensure that you have MOSS SP 1 installed for sure; also install the December Cumulative updates from Microsoft too.
4. Configure your SharePoint web application with AJAX.
It means you have to add some entries in web.config for your SharePoint web application. This could be time consuming and error-prone, instead I recommend you to install this great utility available at Codeplex, http://www.codeplex.com/ajaxifymoss/Release/ProjectReleases.aspx?ReleaseId=13360
It automatically adds the web.config extensions for you.
Here are the installation steps:
- add asp.net ajax to web.config
stsadm -o addajax -url "http://your.moss.webapplication"
NOTE: After installing this, one entry got missed from Safe Control assembly, I guess it is an inherent bug in the utility, go to your web.config file and ensure that this piece of code exists in your web.config Safe Control section
<SafeControl Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TypeName="*" Safe="True" />
If it exists, its good for you, in case it doesn’t, then you have to add it manually
- remove asp.net ajax from web.config
stsadm -o removeajax -url http://your.moss.webapplication
- add .Net 3.5 ajax to web.config
stsadm -o addajax35 -url http://your.moss.webapplication
-remove .Net 3.5 ajax from web.config
stsadm -o removeajax35 -url "http://your.moss.webapplication"
In any case, you are not successful and get stuck, using the above utility, refer to Mike’s blog at: http://sharepoint.microsoft.com/blogs/mike/Lists/Posts/Post.aspx?ID=3 and make the web.config changes manually.
5. Modify your master page. If you have an customized your master page, using SharePoint designer, Check Out and make changes, else if you have deployed master page as a feature, make these changes in your Visual Studio solution and re-deploy the feature once again using upgrade command of stsadm utility
a) Search for <webpartpages:spwebpartmanager id="m" runat="Server"> in your master page and add the Script Manager tag just beneath the above tag
<asp:ScriptManager runat="server" ID="ScriptManager1" />
b) Add the following JavaScript function in your master page, just above the closing head tag
<script type="text/javascript" language="javascript">
function RestoreToOriginalFormAction()
{
if (_spOriginalFormAction != null) {
if (_spEscapedFormAction==document.forms[0].action){
document.forms[0].action=_spOriginalFormAction;
}
_spOriginalFormAction=null;
_spEscapedFormAction=null;
document.forms[0]._initialAction = document.forms[0].action;
}
</script>
c) Add the javascript method RestoreToOriginalFormAction() in the Body onload tag, as follows:
<BODY scroll="yes" onload="javascript:if (typeof(_spBodyOnLoadWrapper) != 'undefined') _spBodyOnLoadWrapper(); RestoreToOriginalFormAction();">
6. Modify your Page Layout
This is the final step in getting your Zone Tabs to work with AJAX, choose your Page Layout depending on your page, where you have added the Easy Tabs webpart, remember the webpart zone: for eg: Left, Middle, Right, Bottom, Top Left, Top Right etc.
We need to place the Update Panel just above the webpart zone, here is the code for update panel (assuming, we are adding the update panel on the left webpart zone), copy this code:
<asp:UpdatePanel id="LeftPanel" runat="server">
<ContentTemplate>
<WebPartPages:WebPartZone runat="server" Title="Left" ID="LeftColumn" Orientation="Vertical">
<ZoneTemplate></ZoneTemplate>
</WebPartPages:WebPartZone>
</ContentTemplate>
</asp:UpdatePanel>
Similar to this you can add many Update Panels in different zones in the same page layout, I added two update panel controls with different id’s on the Left Webpart zone and the other on the Right webpart zone.
Finally go to your site page, see the Easy Tab webparts with AJAX in action. Now when you click any of the tabs, you will see only the webpart zone getting refreshed and not the full page.
If you find this information useful, send in your valuable comments
No comments:
Post a Comment