转: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. 学习笔记7_Java_day11_JSP原理(5)

    4. jsp原理(理解) * jsp其实是一种特殊的Servlet > 当jsp页面第一次被访问时,服务器会把jsp编译成java文件(这个java其实是一个servlet类) > 然后再 ...

  2. Angularjs2——TypeScript学习网站

    https://zhongsp.gitbooks.io/typescript-handbook/content/index.html

  3. spring mvc 笔记

    springmvc 课堂笔记 1.Springmvc是什么 Spring Web MVC是一种基于Java的实现了Web MVC设计模式的请求驱动类型的轻量级Web框架,即使用了MVC架构模式的思想, ...

  4. Effective C++ 学习总结

    摒弃C的做法采用C++的实现方式 以const和inline代替define 以iostream流代替stdio 以new和delete代替 C++风格注释 内存管理 new和delete, new[ ...

  5. 【CF492E】【数学】Vanya and Field

    Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th a ...

  6. 阻止CSS样式被缓存

    <link href="/stylesheet.css?<?php echo time(); ?>" rel="stylesheet" typ ...

  7. Python正则表达式Regular Expression基本用法

    资料来源:http://blog.csdn.net/whycadi/article/details/2011046   直接从网上资料转载过来,作为自己的参考.这个写的很清楚.先拿来看看. 1.正则表 ...

  8. 水晶報表中小寫變大寫的函數-VB

    Function total (ls as number) as string dim dx_sz as string dim dx_dw as string dim str_int as strin ...

  9. MYSQL ERROR 1130: Host is not allowed to connect to this MySQL server

    今天安装MYSQL遇到MYSQL ERROR 1130: Host is not allowed to connect to this MySQL server, 试了很多办法都不行 skip-gra ...

  10. UIPageControll - 图片格式

    设置pageCon的显示风格: 1. 颜色 page.pageIndicatorTintColor = [UIColor redColor]; page.currentPageIndicatorTin ...