转:http://www.cnblogs.com/fatwhale/archive/2010/02/24/1672633.html

在Visual Studio 2010中,  已经集成了用于SharePoint开发的feature,通过它,我们方便快速的开发部署web part、内容类型、列表、工作流 、BDC等,基本上包含了在SharePoint中所有的开发项目。在这篇文章中,向大家介绍一下如果使用它来快速开发和部署Web Part。

    我使用的是Visual Studio 2010 Ultimate Beta 2版本。

新建一个项目,使用SharePoint 2010下的Visual Web Part模板,如图:

接着,会弹出选择部署站点的窗口,输入站点地址,完成:\

看一下解决方案中默认生成的项目:

我们来做一个非常简单web part,页面上放两个单选按钮,一个叫yaoyao,一个叫Elly,点击在图片控件中切换这俩妞的照片,而照片存放在SharePoint站点Layouts下Images文件夹中,注意,我们是通过Visual Studio2010来上传上去,嘿,这是照片,随便在网上找的两张,太火了~

 

首先,我们在VisualWebPart1UserControl.ascx中添加需要的控件,RadioButtonList和Image,并添加两条item,如下:

<asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True"

    onselectedindexchanged="RadioButtonList1_SelectedIndexChanged">

    <asp:ListItem>YaoYao</asp:ListItem>

    <asp:ListItem>Elly</asp:ListItem>

</asp:RadioButtonList>

<asp:Image ID="imgBeauty" runat="server" />



然后,通过Visual Studio 2010向SharePoint 2010上传图片,右键点击项目,添加,SharePoint “Images” Mapped Folder,如图:

然后,将照片添加到这个文件夹中,添加—添加现有项:

我们再来简单的写一些后台处理代码,在RadioButtonList1_SelectedIndexChanged 事件中:

代码

SharePoint 2010中使用Visual Studio 2010进行方便快速的Web Part开发的更多相关文章

  1. 在 Visual Studio 2010 中开发和部署 Windows Azure 应用程序

    原文 在 Visual Studio 2010 中开发和部署 Windows Azure 应用程序 在 Visual Studio 2010 中开发和部署 Windows Azure 应用程序 Jim ...

  2. Visual Studio 2010 vs2010 英文版 使用 已有的中文版 MSDN 帮助文档

    第一步 设置Help Library Manager区域语言 打开Microsoft Visual Studio 2010开始菜单里Visual Studio Tools里的Manage Help S ...

  3. 在 Visual Studio 2010 中创建 SharePoint 2010 事件接收器

    Microsoft Visual Studio 2010 提供了一个可用于生成事件接收器的项目类型,事件接收器会在 Microsoft SharePoint 2010 网站上选择事件之前或之后执行操作 ...

  4. [SharePoint 2010] Visual Studio 2010內撰寫視覺化WebPart超簡單

    新一代的Visual Studio 2010對於SharePoint 2010的專案撰寫,有非常另人讚賞的改進. 以往寫一個WebPart要搞好多雜七雜八的步驟,也要硬寫HTML輸出,當然有人說可以寫 ...

  5. Visual Studio 2010(.NET 4.0)中使用SQLite.NET

    Visual Studio 2010(.NET 4.0)中使用SQLite.NET   2011年4月1日 | 分类: DataBase, DOTNET | 标签: .net 4.0, SQLite. ...

  6. Creating a SharePoint BCS .NET Connectivity Assembly to Crawl RSS Data in Visual Studio 2010

    from:http://blog.tallan.com/2012/07/18/creating-a-sharepoint-bcs-net-assembly-connector-to-crawl-rss ...

  7. 【转】【UML】使用Visual Studio 2010 Team System中的架构师工具(设计与建模)

    Lab 1: 应用程序建模 实验目标 这个实验的目的是展示如何在Visual Studio 2010旗舰版中进行应用程序建模.团队中的架构师会通过建模确定应用程序是否满足客户的需求. 你可以创建不同级 ...

  8. 在Visual Studio 2010/2012中 找不到创建WebService的项目模板

    参考文章: http://blog.sina.com.cn/s/blog_6d545999010152wb.html 在 Visual Studio 2010 或者2012的新建 Web 应用程序或者 ...

  9. Creating SharePoint 2010 Event Receivers in Visual Studio 2010

    转:http://msdn.microsoft.com/en-us/library/gg252010(v=office.14).aspx Summary:  Learn how to create a ...

随机推荐

  1. 【转】 iOS 学习之 NSPredicate 模糊、精确、查询

    简述:Cocoa框架中的NSPredicate用于查询,原理和用法都类似于SQL中的where,作用相当于数据库的过滤取. 定义(最常用到的方法): NSPredicate *ca = [NSPred ...

  2. Codevs 2370 小机房的树

    2370 小机房的树 时间限制: 1 s 空间限制: 256000 KB 题目等级 : 钻石 Diamond 传送门 题目描述 Description 小机房有棵焕狗种的树,树上有N个节点,节点标号为 ...

  3. Sdut 2409 The Best Seat in ACM Contest(山东省第三届ACM省赛 H 题)(模拟)

    题目描述 Cainiao is a university student who loves ACM contest very much. It is a festival for him once ...

  4. main(int argc , char *argv[])

    #include <unistd.h>#include <stdlib.h>#include <stdio.h> int main(int argc, char * ...

  5. BFC与hasLayout之间的故事

    刚拒绝了一个很有诱惑的公司,不是不想去,而是对现在的能力还不确定,希望能够进一步提高自己的技能,所有想写博客了,监督自己的学习进度·········现在还没有开放博客,希望成熟一些后再开放吧! 进入正 ...

  6. javascript 返回顶部

    <style> #linGoTopBtn {    POSITION: fixed; TEXT-ALIGN: center; LINE-HEIGHT: 30px; WIDTH: 30px; ...

  7. placeholder属性兼容js支持

    $(function(){ //判断浏览器是否支持placeholder属性 supportPlaceholder='placeholder'in document.createElement('in ...

  8. yii2源码学习笔记(十七)

    Theme 类,应用的主题,通过替换路径实现主题的应用,方法为获取根路径和根链接:yii2\base\Theme.php <?php /** * @link http://www.yiifram ...

  9. php缓存相关

    在php运行期间,php引擎要对php源码进行处理,(词法分析,语法分析等)然后生成opcode. 然后再运行.在这个阶段可以把opcode缓存起来,当下次需要运行这段程序的时候,就避免了再次 进行词 ...

  10. Activity与WindowManagerService服务的连接过程分析

    Activity组件与WindowManagerService服务之间的连接模型如下图所示: 1. Activity组件 -> WindowManagerService的连接 Activity会 ...