获得<SharePoint:PeopleEditor> 的值
来源:互联网 发布:win10安装ubuntu失败 编辑:程序博客网 时间:2024/06/04 17:48
有时候页面是要放一个PeopleEditor,然后赋值给item。当然最开始的时候想法应该是超级简单,直接把控件的value赋值给item就完事了。结果根本就不是那么一回事。
网上有人提供了方法,写了一大堆,很复杂,两眼没看懂,又感觉怎么不像自己要的。没办法,还是要自己弄一下。
不过还是要承认借鉴了网上通用的方法,只是在SharePoint2010有点变化。
页面加控件:
<SharePoint:PeopleEditor ID="people" runat="server" selectionset="User" MultiSelect="false" />
只选一个人的PeopleEditor控件
下面的方法是拿控件里的值。和网上sharepoint2007版本的有点不同,在string DisplayName行
public static string GetPeopleEditorValue(PeopleEditor objPeopleEditor)
{
string strResult = string.Empty;
ArrayList list = objPeopleEditor.ResolvedEntities;
foreach (Microsoft.SharePoint.WebControls.PickerEntity p in list)
{
string userId = p.EntityData["SPUserID"].ToString();
string DisplayName = p.DisplayText.ToString();
strResult += userId + ";#" + DisplayName;
strResult += ",";
}
return strResult;
}
赋值:
SPContext.Current.ListItem["人"] = GetPeopleEditorValue(people);
如果PeopleEdit里面没有选人,则是空值,ListItem["人"]就是空值,不会报什么错误的。
- 获得<SharePoint:PeopleEditor> 的值
- SharePoint PeopleEditor 控件的使用
- SharePoint PeopleEditor 控件的使用
- SharePoint PeopleEditor 控件的使用
- SharePoint PeopleEditor 控件的使用
- 获得Sharepoint的Version信息
- sharepoint中使用PeopleEditor控件为列表项赋值示例
- sharepoint 2010 从PeopleEditor控件中取出多用户,并返回SPFieldUserValueCollection
- SharePoint 2013 Using PeopleEditor in Custom list or Custom Web Parts
- PeopleEditor允许客户端输入的同时验证输入的内容
- SharePoint中如何获得当前用户的loginName
- sharepoint 获得上级和部门的封装函数
- sharepoint获得热门搜索关键字
- PeopleEditor赋值操作(原创)
- 获得kindedior的值
- sharepoint 2007 修改 SPSiteMapProvider 的portalname值
- SharePoint 2010系列--SharePoint 2010的数据库
- SharePoint Foundation和SharePoint Server的区别
- 理解view.getLeft() getTop() getRight() and getBottom()
- 2011年10月28日
- 立顿草本茶选之沁醒茶 值得品鉴
- MVC演化史(加自己理解和注释)
- Android内核开发必备的基础知识
- 获得<SharePoint:PeopleEditor> 的值
- android系统中自带的图标大全
- 动窗口的制作暨CSizingControlBar类的使用说明
- 前端MVC_01
- DB2性能监控系统,db2性能分析
- Java中hashmap收录1
- 装饰模式之半透明装饰模式
- C\C++学习 --- memmove()
- Linux 时间修改命令