如何将sharepoint列表中choice类型的值绑定到dropdownlist上
2009-10-13 19:48
423 查看
using (SPSite site=new SPSite(siteurl))
{
using(SPWeb web=site.OpenWeb())
{
try
{
SPList list = web.Lists["ServiecesInfo"];
SPFieldChoice spcustomerlocation = new SPFieldChoice(list.Fields, "CustomerLocation");
for (int i = 0; i < spcustomerlocation.Choices.Count; i++)
{
ddlCustomLocation.Items.Add(new ListItem(spcustomerlocation.Choices[i].ToString(), i.ToString()));
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
}
{
using(SPWeb web=site.OpenWeb())
{
try
{
SPList list = web.Lists["ServiecesInfo"];
SPFieldChoice spcustomerlocation = new SPFieldChoice(list.Fields, "CustomerLocation");
for (int i = 0; i < spcustomerlocation.Choices.Count; i++)
{
ddlCustomLocation.Items.Add(new ListItem(spcustomerlocation.Choices[i].ToString(), i.ToString()));
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
}
相关文章推荐
- 陈述如何将sharepoint列表中choice类型的值绑定到dropdownlist上
- SharePoint中的EventReceiver 之二 绑定Event Receiver到列表类型或列表实例
- SharePoint中的EventReceiver 之二 绑定Event Receiver到列表类型或列表实例
- MOSS 2010:Visual Studio 2010开发体验(31)——如何给列表绑定多个内容类型
- MOSS 2010:Visual Studio 2010开发体验(31)——如何给列表绑定多个内容类型
- spring3mvc如何把checkbox的值绑定到model对象的int数据类型
- SharePoint 中的列表定义类型名字及其对应的id(SPListTemplateType )
- 如何解决FormView中实现DropDownList连动选择时出现 "Eval()、XPath() 和 Bind() 这类数据绑定方法只能在数据绑定控件的上下文中使用" 的错误
- sharepoint 2013 如何创建一个webservice获取sharepoint列表数据
- 在Sharepoint中如何共享其他网站中的列表 之补充1
- SharePoint 读取 Site Columns 的数据并绑定到DropdownList
- sharepoint各种字段类型如何读取以及赋值...
- MVC如何绑定复杂类型的页面Model
- DropDownList 绑定数据库中的字段获取下拉列表值
- 使用Netty绑定一个端口如何分辨出多种类型的DTU的注册包
- 如何确定一个SharePoint列表的ID?
- SharePoint如何将使列表不被爬网爬到。
- SharePoint:DataView如何绑定Web Service返回的主从表数据集
- Dropdownlist绑定数据源之后,如何设置期中一个项目为已选项
- sharepoint 2010 如何给文档库或自定义列表添加评论功能