JOJ
踏踏实实做人,认认真真做事!放纵自己就是毁灭自己!

  如何在 sharepoint里面 使用ajax 和 ajaxtoolkit ? 收藏
如何在 sharepoint里面 使用ajax 和 ajaxtoolkit 这个问题我之前去百度和Google个多次!基本上都是说的修改站点下面的配置文件!嘿嘿当然我这里也是修改配置文件!

下面是我在msdn提的问题这个问题! 按照微软里面人员说的步骤配置

http://social.microsoft.com/Forums/zh-CN/partnercndevsharepoint/thread/2d63d004-ef0c-4bad-88e9-c40992e136b8

引用一下他的回复:

关于如何在Sharepoint中配置ASP.NET AJAX,最官方的指导是:
Integrating ASP.NET AJAX with SharePoint
http://sharepoint.microsoft.com/blogs/mike/Lists/Posts/Post.aspx?ID=3
这篇文章中介绍了装和配置 ASP.NET AJAX 1.0 Extensions 的过程。

1.先安装 ASP.NET AJAX 1.0 Extensions ,把 AjaxControlToolkit.dll 放在gac全局缓存里面

2.修改站点下面的web.config文件! 在 http://c1dv2q.blu.livefilestore.com/y1pvl_gf_tuoLPA622YoLz28DnS9x7Ppd81axdMZ2Xti3fmzell0pOQmW5Ybr8B5M01Hsw6G-miTrjtyVts-pAjhAnBnR6lr1Aj/web.config?download 下载web.config覆盖你的web.config 里面写有使用ajax需要加的节点注释! 如果你不覆盖就把那些节点加到你的web.config里面

3.把AjaxControlToolkit.dll拷贝到你站点下的bin目录里面"如:C:\inetpub\wwwroot\wss\VirtualDirectories\9000\bin"了里面

4.写测试代码!

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ajaxTest.ascx.cs" Inherits="Sample.ajaxTest" %>
<%@ Register Assembly="AjaxControlToolkit, Version=3.0.20820.16598, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e"
    Namespace="AjaxControlToolkit" TagPrefix="cc2" %>


<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <asp:TextBox runat="server" ID="tbInput" />
        <asp:Button ID="btnTest" runat="server" Text="测试Ajax" onclick="btnTest_Click" /><br />
        <asp:Label ID="lblShow" runat="server" />
        <br />
    </ContentTemplate>
</asp:UpdatePanel>
<cc2:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0"
            onactivetabchanged="TabContainer1_ActiveTabChanged"
            ondatabinding="TabContainer1_DataBinding">
            <cc2:TabPanel ID="TabPanel1" runat="server" HeaderText="新闻">
            <HeaderTemplate>国际新闻</HeaderTemplate>
            <ContentTemplate>
                    <table>
                        <tr><td>sina</td><td>新浪</td></tr>
                        <tr><td>sohu</td><td>搜狐</td></tr>
                        <tr><td>163</td><td>网易</td></tr>
                    </table>
            </ContentTemplate>
            </cc2:TabPanel>
           
             <cc2:TabPanel ID="TabPanel2" runat="server" HeaderText="博客">
               
            </cc2:TabPanel>
           
              <cc2:TabPanel ID="TabPanel3" runat="server" HeaderText="论坛">
            </cc2:TabPanel>
           
              <cc2:TabPanel ID="TabPanel4" runat="server" HeaderText="好友">
            </cc2:TabPanel>
        </cc2:TabContainer>
       
<asp:SiteMapPath ID="SiteMapPath1" runat="server">
</asp:SiteMapPath>
保存为a.ascx文件并放置 C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\TEMPLATE\CONTROLTEMPLATES目录下面!

5.用sharepoint designer 打开你的端口网站

在Pages文件夹下建立一个sharpointUseAjaxTest.aspx页面!

把下面代码复制进去:

<%@ Page Language="C#" %>
<html dir="ltr" xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
<%@ Register src="~/_controltemplates/ajaxTest2.ascx" tagname="ajaxTest2" tagprefix="uc2" %>
<%@ Register src="~/_controltemplates/ajaxTest.ascx" tagname="ajaxTest" tagprefix="uc1" %>
<head runat="server">
<META name="WebPartPageExpansion" content="full">
<!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:PublishingContactPicture msdt:dt="string">, </mso:PublishingContactPicture><mso:PublishingContact msdt:dt="string"></mso:PublishingContact></mso:CustomDocumentProperties></xml><![endif]-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>This is sharepoint use AJAX test</title>
</head>

<body>
<form id="form1" runat="server">

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<uc2:ajaxTest2 ID="ajaxTest2" runat="server"/>
<uc1:ajaxTest ID="ajaxTest1" runat="server"/>
</form>
</body>

</html>
保存,签入 。右键 ”在浏览器中预览“  即可看到效果!

注意他的地址 为:http://server:port/_layouts/sharpointUseAjaxTest.aspx

只不过我这把他放到sharepoint里面的样式 和 vs里面不一样! 如果有谁知道怎么解决样式冲突原因,记得告诉我哦! 谢谢!

 

 

posted on 2010-03-29 23:51  JoinJ  阅读(425)  评论(0编辑  收藏  举报