惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
I
InfoQ
L
LangChain Blog
阮一峰的网络日志
阮一峰的网络日志
Y
Y Combinator Blog
博客园_首页
Martin Fowler
Martin Fowler
宝玉的分享
宝玉的分享
A
About on SuperTechFans
Apple Machine Learning Research
Apple Machine Learning Research
Vercel News
Vercel News
T
The Blog of Author Tim Ferriss
C
Check Point Blog
B
Blog RSS Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Engineering at Meta
Engineering at Meta
B
Blog
爱范儿
爱范儿
Stack Overflow Blog
Stack Overflow Blog
aimingoo的专栏
aimingoo的专栏
WordPress大学
WordPress大学
F
Fortinet All Blogs
月光博客
月光博客
GbyAI
GbyAI

博客园 - 蒜头

Mailbox unavailable. The server response was: 5.7.1 Unable to relay for (email address). 再谈Images到xps,pdf的转换 SQL Server 2005中xml类型和函数的简单应用 部分Office 2007文件格式转换为xps和pdf代码整理 Image.FromFile gives "Out of Memory" Exception for icon - 蒜头 简单介绍PDF,XPS,Images,Office 2007之间的转换方法 - 蒜头 - 博客园 SQL 2005 全文检索(续) 简单实现C#生成Excel 2007文件并下载 简单应用ReportViewer控件 配置SQL Server Session方法 采用负载均衡,部署了两个ASP.NET 2.0的站点服务器碰到的问题 初试VSTS 2008(TFS安装) Windows Server 2003分区修改方法[转载] 制作VSTO 2005 SE开发的Office 2007 AddIn的安装包 一个简单的document library event handler VS 2005 SP1 安装错误 [续] 一个简单的Checkbox Custom Field Type ASP.NET 2.0 SQL Cache 配置方法 解读Document Library关于权限的对象模型
SharePoint应用AJAX.NET和AJAX Control Toolkit
蒜头 · 2007-08-11 · via 博客园 - 蒜头

1. 首先,在SharePoint服务器上安装ASP.NET 2.0 AJAX Extensions.

2. 修改SP站点web.config,在c:\inetpub\wwwroot\wss\virtualdirectories\下会有对应站点占用端口号的文件夹,web.config就在这里:
  1)  在<configSections>下添加

    2) <SafeControls>下添加:

<SafeControl Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TypeName="*" Safe="True" />

  3)  在 <httpHandlers>下添加:

  4)  在<httpModules>下添加:

<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

  5) 在<assemblies>下添加:

<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

  6) 在<pages>下添加:

<controls>
        
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      
</controls>

 7) 在<configuration>下的最后添加:

<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>

3. 在webpart中就使用ScriptManager和UpdatePanel
  1)  添加 System.Web.Extensions引用
  2)  添加代码如下:

此代码来自十一

  3)  在CreateChildControls()方法里添加UpdatePanel:

            UpdatePanel up = new UpdatePanel();
            up.ID 
= "UpdatePanel2";
            up.ChildrenAsTriggers 
= true;
            up.UpdateMode 
= UpdatePanelUpdateMode.Always;
            
this.Controls.Add(up);

            Button button 
= new Button();
            button.Text 
= "Groups";
            button.Click 
+= new EventHandler(HandleButtonClick);
            up.ContentTemplateContainer.Controls.Add(button);

            listbox1 
= new ListBox();
            listbox2 
= new ListBox();
            up.ContentTemplateContainer.Controls.Add(listbox1);
            up.ContentTemplateContainer.Controls.Add(listbox2);

Button事件:

        private void HandleButtonClick(object sender, EventArgs eventArgs)
        
{
            SPWeb currentWeb 
= SPContext.Current.Web;
            
foreach (SPGroup group in currentWeb.CurrentUser.Groups)
            
{
                listbox1.Items.Add(group.Name);
            }

            
foreach (SPGroup group in currentWeb.CurrentUser.OwnedGroups)
            
{
                listbox2.Items.Add(group.Name);
            }

        }

1. 将AjaxControlToolkit.dll添加到GAC.
将AjaxControlToolkit.dll拖拽到C:\Windows\Assembly下就可以了.

2. 继续修改WSS站点web.config
 在<assemblies>下添加:

<add assembly="AjaxControlToolkit, Version=1.0.10618.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" />

 在<controls>下添加:

<add tagPrefix="ajaxToolkit" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit, Version=1.0.10618.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" />

这样,在WebPart中就可以使用Toolkit里面的控件了。

添加AjaxControlToolkit引用;

在上面代码基础上添加代码:

this.textBox = new TextBox();
            
this.textBox.ID = "TextBox";
            up.ContentTemplateContainer.Controls.Add(
this.textBox);
            c 
= new AjaxControlToolkit.CalendarExtender();
            c.TargetControlID 
= "TextBox";
            up.ContentTemplateContainer.Controls.Add(c);


我们也可以在webpart中加载包含Toolkit 控件的UC。

            Control ctl = Page.LoadControl("~\\wpresources\\MyJAJXCalendar.ascx");
            Controls.Add(ctl);

当然,UC也可以用Feature去加载到页面上。
效果如下: