SharePoint 2010中使用Visual Studio 2010进行方便快速的Web Part开发
2010-02-24 14:04
459 查看
在Visual Studio 2010中, 已经集成了用于SharePoint开发的feature,通过它,我们方便快速的开发部署web part、内容类型、列表、工作流 、BDC等,基本上包含了在SharePoint中所有的开发项目。在这篇文章中,向大家介绍一下如果使用它来快速开发和部署Web Part。
我使用的是Visual Studio 2010 Ultimate Beta 2版本。
代码
namespace MyFirstWebPart.VisualWebPart1
{
public partial class VisualWebPart1UserControl : UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.RadioButtonList1.SelectedItem.Text == "YaoYao")
{
this.imgBeauty.ImageUrl = @"_layouts/Images/myfirstwebpart/chinayaoyao.jpg";
}
else
{
this.imgBeauty.ImageUrl = @"_layouts/Images/myfirstwebpart/Elly.jpg";
}
}
}
}
我们的web part就算完成了,修改一下这个web part的名字和描述,然后把它发布到站点上,
点击VisualWebPart1.webpart文件,修改对应的名字和描述:
<data>
<properties>
<property name="Title" type="string">My First WebPart</property>
<property name="Description" type="string">Yaoyao and Elly</property>
</properties>
</data>
发布,右键点击项目,发布,就这么简单:
把web part部署到页面上,这个过程大家应该很熟悉了,前几篇文章中已经介绍,这儿不在赘述,自定义开发的web part在custom中,可以看到我们刚才命名和描述的web part.
好了,再来欣赏下我们的美女,点击YaoYao,点击Elly,再点,再点,再点。。。。。。。
我使用的是Visual Studio 2010 Ultimate Beta 2版本。
代码
namespace MyFirstWebPart.VisualWebPart1
{
public partial class VisualWebPart1UserControl : UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.RadioButtonList1.SelectedItem.Text == "YaoYao")
{
this.imgBeauty.ImageUrl = @"_layouts/Images/myfirstwebpart/chinayaoyao.jpg";
}
else
{
this.imgBeauty.ImageUrl = @"_layouts/Images/myfirstwebpart/Elly.jpg";
}
}
}
}
我们的web part就算完成了,修改一下这个web part的名字和描述,然后把它发布到站点上,
点击VisualWebPart1.webpart文件,修改对应的名字和描述:
<data>
<properties>
<property name="Title" type="string">My First WebPart</property>
<property name="Description" type="string">Yaoyao and Elly</property>
</properties>
</data>
发布,右键点击项目,发布,就这么简单:
把web part部署到页面上,这个过程大家应该很熟悉了,前几篇文章中已经介绍,这儿不在赘述,自定义开发的web part在custom中,可以看到我们刚才命名和描述的web part.
好了,再来欣赏下我们的美女,点击YaoYao,点击Elly,再点,再点,再点。。。。。。。
相关文章推荐
- SharePoint 2010中使用Visual Studio 2010进行方便快速的Web Part开发
- SharePoint 2010中使用Visual Studio 2010进行方便快速的Web Part开发
- SharePoint 2010中使用Visual Studio 2010进行方便快速的Web Part开发
- MOSS 2010:Visual Studio 2010开发体验(20)——使用ADO.NET Data Service快速访问SharePoint列表数据
- MOSS 2010:Visual Studio 2010开发体验(20)——使用ADO.NET Data Service快速访问SharePoint列表数据
- MOSS 2010:Visual Studio 2010开发体验(20)——使用ADO.NET Data Service快速访问SharePoint列表数据
- “SharePoint 2010应用程序开发指南”节选 - 第二章 使用Visual Studio
- SharePoint开发中如何使用Visual Studio给你的Web Part添加图标
- 使用Visual Studio 2010与Visual Studio 11“合作”开发SharePoint 2011
- SharePoint开发中如何使用Visual Studio给你的Web Part添加图标
- SharePoint 2010中使用JavaScript进行客户端开发
- 使用Visual Studio 2010与Visual Studio 11“合作”开发SharePoint 2011程序
- SharePoint 2010中使用JavaScript进行客户端开发
- “SharePoint 2010应用程序开发指南”节选 - 第二章 使用Visual Studio 2010 - 第一节
- SharePoint 2010中使用JavaScript进行客户端开发
- [ZZ]基于Visual Studio 2010 进行敏捷/Scrum模式开发
- 转发在Visual Studio 2010/2012/2013/2015上使用C#开发Android/IOS安装包和操作步骤
- 使用myeclipse进行hibernate快速开发
- 在Visual Studio 2010 里使用Nunit 进行Debug 测试
- 使用Visual Studio快速开发STM32F4-Discovery探索板入门