Today, I would like to share with you the "pain" of getting AJAX to run in MOSS. Don't get me wrong, once it works it is the coolest thing ever, but there are a lot of ways to screw things up.
What I would like to do is to list everything in logical order and then support the important points with code and screen shots.
How to get AJAX working in a MOSS 2007 (SP1) custom web part
In order to get AJAX to work, make sure you have AJAX Extensions 1.0 installed . If not do so....duh!
- Build a simple custom web part and make sure it works. This is an entire post in its own. There are a lot of resources out there that help you do this. Here are a couple of good web sites...:
- http://www.developer.com/net/asp/article.php/3620316
- http://www.datasprings.com/Resources/ArticlesInformation/Sharepoint2007CustomWebParts/tabid/775/Default.aspx
- http://msdn2.microsoft.com/en-us/library/ms415817.aspx
- Once the web part works add a new reference to the System.Web.Extensionns (1.0.XXX) in our web part project. This will allow you to instantiate objects from the ScriptManager and UpdatePanel classes.
- Modification to the web.config file. This will register "System.Web.Extensions" in the SharePoint environment.
- IF YOU HAVE A CUSTOM .MASTER FILE FOR YOUR PORTAL/SITE, MAKE SURE THAT THE <WebPartPages:SPWebPartManager runat="server"/> IS *WITHIN* THE <form....> tag.
- Add the actual code to the custom web part.
Web.config modifications (code)
<!--
AJAX INTEGRATION POST SP1 UPGRADE-->
<?
xml version="1.0" encoding="UTF-8" standalone="yes"?>
<
configuration>
<
configSections>
<
sectionGroup name="SharePoint">
<
section name="SafeControls" type="Microsoft.SharePoint.ApplicationRuntime.SafeControlsConfigurationHandler, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<
section name="RuntimeFilter" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<
section name="WebPartLimits" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<
section name="WebPartCache" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<
section name="WebPartWorkItem" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<
section name="WebPartControls" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<
section name="SafeMode" type="Microsoft.SharePoint.ApplicationRuntime.SafeModeConfigurationHandler, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<
section name="MergedActions" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<
section name="PeoplePickerWildcards" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<
section name="BlobCache" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</
sectionGroup>
<
sectionGroup name="System.Workflow.ComponentModel.WorkflowCompiler" type="System.Workflow.ComponentModel.Compiler.WorkflowCompilerConfigurationSectionGroup, System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<
section name="authorizedTypes" type="System.Workflow.ComponentModel.Compiler.AuthorizedTypesSectionHandler, System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</
sectionGroup>
<!--
AJAX -->
<
sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<
sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<
section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<
sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<
section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere" />
<
section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
<
section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
</
sectionGroup>
</
sectionGroup>
</
sectionGroup>
</
configSections>
<
SharePoint>
<
SafeMode MaxControls="200" CallStack="false" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">
<
PageParserPaths>
</
PageParserPaths>
</
SafeMode>
<
WebPartLimits MaxZoneParts="50" PropertySize="1048576" />
<
WebPartCache Storage="CacheObject" />
<
WebPartControls DatasheetControlGuid="65BCBEE4-7728-41a0-97BE-14E1CAE36AAE" />
<
SafeControls>
<
SafeControl Assembly="System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="System.Web.UI.WebControls" TypeName="*" Safe="True" AllowRemoteDesigner="True" />
<
SafeControl Assembly="System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="System.Web.UI.HtmlControls" TypeName="*" Safe="True" AllowRemoteDesigner="True" />
<
SafeControl Assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="System.Web.UI" TypeName="*" Safe="True" AllowRemoteDesigner="True" />
<
SafeControl Assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="System.Web.UI.WebControls" TypeName="SqlDataSource" Safe="False" AllowRemoteDesigner="False" />
<
SafeControl Assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="System.Web.UI.WebControls" TypeName="AccessDataSource" Safe="False" AllowRemoteDesigner="False" />
<
SafeControl Assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="System.Web.UI.WebControls" TypeName="XmlDataSource" Safe="False" AllowRemoteDesigner="False" />
<
SafeControl Assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="System.Web.UI.WebControls" TypeName="ObjectDataSource" Safe="False" AllowRemoteDesigner="False" />
<
SafeControl Assembly="Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint" TypeName="*" Safe="True" AllowRemoteDesigner="True" />
<
SafeControl Assembly="Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.WebPartPages" TypeName="*" Safe="True" AllowRemoteDesigner="True" />
<
SafeControl Assembly="Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.WebControls" TypeName="*" Safe="True" AllowRemoteDesigner="True" />
<
SafeControl Assembly="Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.ApplicationPages" TypeName="*" Safe="True" AllowRemoteDesigner="True" />
<
SafeControl Assembly="Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.SoapServer" TypeName="*" Safe="True" AllowRemoteDesigner="True" />
<
SafeControl Assembly="Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.Meetings" TypeName="*" Safe="True" AllowRemoteDesigner="True" />
<
SafeControl Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint" TypeName="*" Safe="True" AllowRemoteDesigner="True" />
<
SafeControl Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.WebPartPages" TypeName="*" Safe="True" AllowRemoteDesigner="True" />
<
SafeControl Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.WebControls" TypeName="*" Safe="True" AllowRemoteDesigner="True" />
<
SafeControl Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.ApplicationPages" TypeName="*" Safe="True" AllowRemoteDesigner="True" />
<
SafeControl Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.SoapServer" TypeName="*" Safe="True" AllowRemoteDesigner="True" />
<
SafeControl Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.Meetings" TypeName="*" Safe="True" AllowRemoteDesigner="True" />
<
SafeControl Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.Workflow" TypeName="*" Safe="True" AllowRemoteDesigner="True" />
<
SafeControl Assembly="Microsoft.SharePoint.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.Search.WebControls" TypeName="*" Safe="True" AllowRemoteDesigner="True" />
<
SafeControl Assembly="Microsoft.SharePoint.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.Search.Internal.WebControls" TypeName="*" Safe="True" AllowRemoteDesigner="True" />
<
SafeControl Src="~/_controltemplates/*" IncludeSubFolders="True" Safe="True" AllowRemoteDesigner="True" />
<
SafeControl Assembly="Microsoft.Office.Workflow.Feature, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.Office.Workflow.Feature" TypeName="ProcessAllTasksButton" Safe="True" />
<
SafeControl Assembly="Microsoft.Office.Excel.WebUI, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.Office.Excel.WebUI" TypeName="*" />
<
SafeControl Assembly="Microsoft.Office.Server.UI, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.Office.Server.WebControls" TypeName="*" />
<
SafeControl Assembly="Microsoft.SharePoint.Portal, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.Portal.WebControls" TypeName="*" />
<
SafeControl Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.Publishing" TypeName="*" />
<
SafeControl Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.Publishing.Internal.WebControls" TypeName="*" />
<
SafeControl Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.Publishing.WebControls" TypeName="*" />
<
SafeControl Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.Publishing.Navigation" TypeName="*" />
<
SafeControl Assembly="Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.Office.Server.WebControls" TypeName="*" />
<
SafeControl Assembly="Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.Office.Server.WebControls.FieldTypes" TypeName="*" />
<
SafeControl Assembly="Microsoft.Office.Workflow.Feature, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.Office.Server.WebControls.FieldTypes" TypeName="*" />
<
SafeControl Assembly="Microsoft.Office.Excel.WebUI, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.Office.Excel.WebUI" TypeName="*" />
<
SafeControl Assembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.Portal.WebControls" TypeName="*" />
<
SafeControl Assembly="Microsoft.Office.Server.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.Office.Server.Search.WebControls" TypeName="*" Safe="True" />
<
SafeControl Assembly="WebPartToExplorer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=aa73fbe2a55d9edc" Namespace="WebPartToExplorer" TypeName="*" Safe="True" />
<!--
AJAX -->
<
SafeControl Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TypeName="*" Safe="True" />
</
SafeControls>
<
PeoplePickerWildcards>
<
clear />
<
add key="AspNetSqlMembershipProvider" value="%" />
</
PeoplePickerWildcards>
<
MergedActions>
<
Action id="bf064279-3567-42bf-a34d-0a74f6fe56ca" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.dlc.xml" />
<
Action id="e3b7adae-f5db-4ce5-becb-1af83f7938ce" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.ewr.xml" />
<
Action id="89be315b-a983-44f9-b1ed-d9920cf5528e" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.osrv.xml" />
<
Action id="2637af1c-f384-4440-ab0c-e07a2e45f4d5" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.osrv.xml" />
<
Action id="fc002d03-7839-402b-a94a-1c9a2d40b63d" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.sps.xml" />
<
Action id="cd6122b2-5c40-45fb-952b-908354a91e33" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.sps.xml" />
<
Action id="2365277a-c5ee-4589-84d4-c759e6b9477d" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.sps.xml" />
<
Action id="0582988f-9c26-4990-8672-0099f4567b03" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.sps.xml" />
<
Action id="9008b35c-3ad5-4831-bcbe-ec456a4e152b" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.sps.xml" />
<
Action id="009e5494-26c5-4181-936f-4d16f444b642" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.sps.xml" />
<
Action id="ab44b1d7-83b4-487b-ae26-22abe4008258" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.sps.xml" />
<
Action id="72db2c92-8bc1-4767-a12c-94b67d46d0cf" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.sps.xml" />
<
Action id="4cc2777f-e9ed-4af4-acbb-9f101f64e4d6" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.sps.xml" />
<
Action id="4cca960b-247e-4743-9f4b-835975e867f9" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.sps.xml" />
<
Action id="5552b985-f1b8-4647-83e1-97a3a8d5ca60" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.sps.xml" />
<
Action id="4e6e31a8-e068-491e-8d32-38da48dcf10a" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.sps.xml" />
<
Action id="090de644-e7ee-4a67-8fbf-8f41f2b4f1ff" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.sps.xml" />
<
Action id="2468c72a-0386-4c9e-9143-392fe192f9c0" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.sps.xml" />
<
Action id="0f0fbbf9-92c0-49d0-89bd-969b596d8492" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.sps.xml" />
<
Action id="eaa3e0c0-973a-4dbd-96e9-48f7837a8909" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.spss.xml" />
<
Action id="8182ca12-e9a6-4f4f-9cfe-8a0a21e217e6" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.spss.xml" />
<
Action id="5055b13f-c200-45dd-8dbd-b046710e01ac" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.spss.xml" />
<
Action id="5321d9c5-2486-49e8-bd2d-ab555ac4083d" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.spss.xml" />
<
Action id="ea2d54ca-cd14-48a7-a5ca-b10b24141937" sourceFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\webconfig.spss.xml" />
</
MergedActions>
<
BlobCache location="C:\blobCache" path="\.(gif|jpg|png|css|js)$" maxSize="10" enabled="false" />
<
RuntimeFilter Assembly="Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Class="Microsoft.Office.Server.Audience.AudienceManager" BuilderURL="audience_chooser.aspx" />
</
SharePoint>
<
system.web>
<
securityPolicy>
<
trustLevel name="WSS_Medium" policyFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\wss_mediumtrust.config" />
<
trustLevel name="WSS_Minimal" policyFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\wss_minimaltrust.config" />
</
securityPolicy>
<
httpHandlers>
<
remove verb="GET,HEAD,POST" path="*" />
<
add verb="GET,HEAD,POST" path="*" type="Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<
add verb="OPTIONS,PROPFIND,PUT,LOCK,UNLOCK,MOVE,COPY,GETLIB,PROPPATCH,MKCOL,DELETE,(GETSOURCE),(HEADSOURCE),(POSTSOURCE)" path="*" type="Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<
add verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<!--
AJAX -->
<
add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<
add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<
add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</
httpHandlers>
<
customErrors mode="On" />
<
httpRuntime maxRequestLength="51200" />
<
authentication mode="Windows" />
<
identity impersonate="true" />
<
authorization>
<
allow users="*" />
</
authorization>
<
httpModules>
<
clear />
<
add name="SPRequest" type="Microsoft.SharePoint.ApplicationRuntime.SPRequestModule, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<
add name="OutputCache" type="System.Web.Caching.OutputCacheModule" />
<
add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />
<
add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />
<
add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule" />
<
add name="RoleManager" type="System.Web.Security.RoleManagerModule" />
<
add name="Session" type="System.Web.SessionState.SessionStateModule"/>
<
add name="PublishingHttpModule" type="Microsoft.SharePoint.Publishing.PublishingHttpModule, Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<!--
AJAX -->
<
add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</
httpModules>
<
globalization fileEncoding="utf-8" />
<
compilation batch="false" debug="false">
<
assemblies>
<
add assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<!--
AJAX -->
<
add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</
assemblies>
<
expressionBuilders>
<
remove expressionPrefix="Resources" />
<
add expressionPrefix="Resources" type="Microsoft.SharePoint.SPResourceExpressionBuilder, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<
add expressionPrefix="SPHtmlEncodedResources" type="Microsoft.SharePoint.SPHtmlEncodedResourceExpressionBuilder, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<
add expressionPrefix="SPSimpleFormattingEncodedResources" type="Microsoft.SharePoint.SPSimpleFormattingEncodedResourceExpressionBuilder, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<
add expressionPrefix="SPUrl" type="Microsoft.SharePoint.Publishing.WebControls.SPUrlExpressionBuilder, Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
</
expressionBuilders>
</
compilation>
<
pages enableSessionState="false" enableViewState="true" enableViewStateMac="true" validateRequest="false" pageParserFilterType="Microsoft.SharePoint.ApplicationRuntime.SPPageParserFilter, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" asyncTimeout="7">
<
namespaces>
<
remove namespace="System.Web.UI.WebControls.WebParts" />
</
namespaces>
<
tagMapping>
<
add tagType="System.Web.UI.WebControls.SqlDataSource, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mappedTagType="Microsoft.SharePoint.WebControls.SPSqlDataSource, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
</
tagMapping>
<!--
AJAX -->
<
controls>
<
add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</
controls>
</
pages>
<
siteMap defaultProvider="CurrentNavSiteMapProvider" enabled="true">
<
providers>
<
add name="SPNavigationProvider" type="Microsoft.SharePoint.Navigation.SPNavigationProvider, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<
add name="SPSiteMapProvider" type="Microsoft.SharePoint.Navigation.SPSiteMapProvider, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<
add name="SPContentMapProvider" type="Microsoft.SharePoint.Navigation.SPContentMapProvider, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<
add name="SPXmlContentMapProvider" siteMapFile="_app_bin/layouts.sitemap" type="Microsoft.SharePoint.Navigation.SPXmlContentMapProvider, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<
add name="AdministrationQuickLaunchProvider" description="QuickLaunch navigation provider for the central administration site" type="Microsoft.Office.Server.Web.AdministrationQuickLaunchProvider, Microsoft.Office.Server.UI, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<
add name="SharedServicesQuickLaunchProvider" description="QuickLaunch navigation provider for shared services administration sites" type="Microsoft.Office.Server.Web.SharedServicesQuickLaunchProvider, Microsoft.Office.Server.UI, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<
add name="GlobalNavSiteMapProvider" description="CMS provider for Global navigation" type="Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" NavigationType="Global" EncodeOutput="true" />
<
add name="CombinedNavSiteMapProvider" description="CMS provider for Combined navigation" type="Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" NavigationType="Combined" EncodeOutput="true" />
<
add name="CurrentNavSiteMapProvider" description="CMS provider for Current navigation" type="Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" NavigationType="Current" EncodeOutput="true" />
<
add name="CurrentNavSiteMapProviderNoEncode" description="CMS provider for Current navigation, no encoding of output" type="Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" NavigationType="Current" EncodeOutput="false" />
<
add name="SiteDirectoryCategoryProvider" description="Site Directory category provider" type="Microsoft.SharePoint.Portal.WebControls.SiteDirectoryCategoryProvider, Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<
add name="MySiteMapProvider" description="MySite provider that returns areas and based on the current user context" type="Microsoft.SharePoint.Portal.MySiteMapProvider, Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<
add name="MySiteLeftNavProvider" description="MySite Left Nav provider that returns areas and based on the current user context" type="Microsoft.SharePoint.Portal.MySiteLeftNavProvider, Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<
add name="UsagePagesSiteMapProvider" description="Provider for navigation in Portal Usage pages" type="Microsoft.SharePoint.Portal.Analytics.UsagePagesSiteMapProvider, Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
</
providers>
</
siteMap>
<
trust level="Full" originUrl="" />
<
webParts>
<
transformers>
<
add name="TransformableFilterValuesToFilterValuesTransformer" type="Microsoft.SharePoint.WebPartPages.TransformableFilterValuesToFilterValuesTransformer, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<
add name="TransformableFilterValuesToParametersTransformer" type="Microsoft.SharePoint.WebPartPages.TransformableFilterValuesToParametersTransformer, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<
add name="TransformableFilterValuesToFieldTransformer" type="Microsoft.SharePoint.WebPartPages.TransformableFilterValuesToFieldTransformer, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<
add name="TransformableFilterValuesToEntityInstanceTransformer" type="Microsoft.SharePoint.Portal.WebControls.TransformableFilterValuesToEntityInstanceTransformer, Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
</
transformers>
</
webParts>
<
machineKey validationKey="0729CBD31EBB9C5F7E7E4E2D135992DD56540CE1F9614048" decryptionKey="B71AF603CCB593D3F80E58329A0AD968C4BD8F2EE8E72A17" validation="SHA1" />
</
system.web>
<
runtime>
<
assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<
dependentAssembly>
<
assemblyIdentity name="Microsoft.SharePoint" publicKeyToken="71e9bce111e9429c" culture="neutral" />
<
bindingRedirect oldVersion="11.0.0.0" newVersion="12.0.0.0" />
</
dependentAssembly>
<
dependentAssembly>
<
assemblyIdentity name="Microsoft.SharePoint.Dsp" publicKeyToken="71e9bce111e9429c" culture="neutral" />
<
bindingRedirect oldVersion="11.0.0.0" newVersion="12.0.0.0" />
</
dependentAssembly>
<
dependentAssembly>
<
assemblyIdentity name="Microsoft.SharePoint.Dsp.OleDb" publicKeyToken="71e9bce111e9429c" culture="neutral" />
<
bindingRedirect oldVersion="11.0.0.0" newVersion="12.0.0.0" />
</
dependentAssembly>
<
dependentAssembly>
<
assemblyIdentity name="Microsoft.SharePoint.Dsp.SoapPT" publicKeyToken="71e9bce111e9429c" culture="neutral" />
<
bindingRedirect oldVersion="11.0.0.0" newVersion="12.0.0.0" />
</
dependentAssembly>
<
dependentAssembly>
<
assemblyIdentity name="Microsoft.SharePoint.Dsp.Sts" publicKeyToken="71e9bce111e9429c" culture="neutral" />
<
bindingRedirect oldVersion="11.0.0.0" newVersion="12.0.0.0" />
</
dependentAssembly>
<
dependentAssembly>
<
assemblyIdentity name="Microsoft.SharePoint.Dsp.XmlUrl" publicKeyToken="71e9bce111e9429c" culture="neutral" />
<
bindingRedirect oldVersion="11.0.0.0" newVersion="12.0.0.0" />
</
dependentAssembly>
<
dependentAssembly>
<
assemblyIdentity name="Microsoft.SharePoint.intl" publicKeyToken="71e9bce111e9429c" culture="neutral" />
<
bindingRedirect oldVersion="11.0.0.0" newVersion="12.0.0.0" />
</
dependentAssembly>
<
dependentAssembly>
<
assemblyIdentity name="Microsoft.SharePoint.Library" publicKeyToken="71e9bce111e9429c" culture="neutral" />
<
bindingRedirect oldVersion="11.0.0.0" newVersion="12.0.0.0" />
</
dependentAssembly>
<
dependentAssembly>
<
assemblyIdentity name="Microsoft.SharePoint.Security" publicKeyToken="71e9bce111e9429c" culture="neutral" />
<
bindingRedirect oldVersion="11.0.0.0" newVersion="12.0.0.0" />
</
dependentAssembly>
<
probing privatePath="bin;_app_bin" />
<
dependentAssembly xmlns="urn:schemas-microsoft-com:asm.v1">
<
assemblyIdentity name="Microsoft.SharePoint.Portal" publicKeyToken="71e9bce111e9429c" culture="neutral" />
<
bindingRedirect oldVersion="11.0.0.0" newVersion="12.0.0.0" />
</
dependentAssembly>
</
assemblyBinding>
</
runtime>
<
location path="_layouts/images">
<
system.web>
<
authorization>
<
allow users="*" />
</
authorization>
</
system.web>
</
location>
<
location path="_layouts/mobile/mbllogin.aspx">
<
system.web>
<
authorization>
<
allow users="*" />
</
authorization>
</
system.web>
</
location>
<
System.Workflow.ComponentModel.WorkflowCompiler>
<
authorizedTypes>
<
authorizedType Assembly="System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.*" TypeName="*" Authorized="True" />
<
authorizedType Assembly="System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.*" TypeName="*" Authorized="True" />
<
authorizedType Assembly="System.Workflow.Runtime, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.*" TypeName="*" Authorized="True" />
<
authorizedType Assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System*" TypeName="*" Authorized="True" />
<
authorizedType Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System*" TypeName="*" Authorized="True" />
<
authorizedType Assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System*" TypeName="*" Authorized="True" />
<
authorizedType Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.Workflow" TypeName="SPWorkflowActivationProperties" Authorized="True" />
<
authorizedType Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.Workflow" TypeName="SPWorkflowTaskProperties" Authorized="True" />
<
authorizedType Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.Workflow" TypeName="SPWorkflowHistoryEventType" Authorized="True" />
<
authorizedType Assembly="Microsoft.SharePoint.WorkflowActions, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.WorkflowActions" TypeName="*" Authorized="True" />
</
authorizedTypes>
</
System.Workflow.ComponentModel.WorkflowCompiler>
<
appSettings>
<
add key="FeedCacheTime" value="300" />
<
add key="FeedPageUrl" value="/_layouts/feed.aspx?" />
<
add key="FeedXsl1" value="/Style Library/Xsl Style Sheets/Rss.xsl" />
<
add key="ReportViewerMessages" value="Microsoft.SharePoint.Portal.Analytics.UI.ReportViewerMessages, Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
</
appSettings>
<
system.net>
<
defaultProxy>
<
proxy autoDetect="true" />
</
defaultProxy>
</
system.net>
<!--
AJAX -->
<
system.web.extensions>
<
scripting>
<
webServices>
<!--
Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
<!--
<authenticationService enabled="true" requireSSL = "true|false"/>
-->
<!--
Uncomment these lines to enable the profile service. To allow profile properties to be retrieved and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and writeAccessProperties attributes. -->
<!--
<profileService enabled="true"
readAccessProperties="propertyname1,propertyname2"
writeAccessProperties="propertyname1,propertyname2" />
-->
</
webServices>
<!--
<scriptResourceHandler enableCompression="true" enableCaching="true" />
-->
</
scripting>
</
system.web.extensions>
<
system.webServer>
<
validation validateIntegratedModeConfiguration="false"/>
<
modules>
<
add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</
modules>
<
handlers>
<
remove name="WebServiceHandlerFactory-Integrated" />
<
add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<
add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<
add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</
handlers>
</
system.webServer>
</
configuration>
Actual code for the web part
using
System;
using
System.Text;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
namespace
WebPartToExplorer
{
public class AjaxWebPartToExplore:System.Web.UI.WebControls.WebParts.WebPart
{
private Label displayName;
private TextBox inputName;
protected override void CreateChildControls()
{
base.CreateChildControls();
//Fix for the UpdatePanel postback behaviour.
EnsurePanelFix();
LinkButton sayHello = new LinkButton();
UpdatePanel refreshName = new UpdatePanel();
ScriptManager scriptHandler = new ScriptManager();
displayName =
new Label();
inputName =
new TextBox();
//Set up control properties.
this.displayName.ID = "displayName";
this.displayName.Text = "";
this.inputName.ID = "inputName";
sayHello.ID =
"sayHello";
sayHello.Text =
" Click me! ";
scriptHandler.ID =
"scriptHandler";
refreshName.ID =
"refreshName";
refreshName.UpdateMode =
UpdatePanelUpdateMode.Conditional;
refreshName.ChildrenAsTriggers =
true;
//Add the EventHandler to the Button.
sayHello.Click +=
new EventHandler(ClickHandler);
//Add the user interface (UI) controls to the UpdatePanel.
refreshName.ContentTemplateContainer.Controls.Add(
this.inputName);
refreshName.ContentTemplateContainer.Controls.Add(sayHello);
refreshName.ContentTemplateContainer.Controls.Add(
this.displayName);
//The ScriptManager control must be added first.
this.Controls.Add(scriptHandler);
this.Controls.Add(refreshName);
}
private void ClickHandler(object sender, EventArgs args)
{
if (this.inputName.Text == String.Empty)
{
this.displayName.Text = "Just click...no value.";
}
else
{
this.displayName.Text = "You entered: " + this.inputName.Text.ToString() + ".";
}
}
private void EnsurePanelFix()
{
if (this.Page.Form != null)
{
string formOnSubmitAtt = this.Page.Form.Attributes["onsubmit"];
if (formOnSubmitAtt == "return _spFormOnSubmitWrapper();")
{
this.Page.Form.Attributes["onsubmit"] = "_spFormOnSubmitWrapper();";
}
}
ScriptManager.RegisterStartupScript(this, typeof(AjaxWebPartToExplore), "UpdatePanelFixup", "_spOriginalFormAction = document.forms[0].action; _spSuppressFormOnSubmitWrapper=true;", true);
}
}
}
This should get you going. Let me know if you need more detail. I am happy to answer questions.
Good luck...
--tolga--