首页 > 代码库 > Sharepoint Webpart 自定义属性
Sharepoint Webpart 自定义属性
namespace Webpart.Staffing.ViewAll { [ToolboxItemAttribute(false)] public partial class ViewAll : WebPart { public ViewAll() { } private string _listName; [Personalizable(true)] [WebBrowsable(true)] [Category("Customize")] [WebDisplayName("List Name")] public string ListName { set { _listName = value; } get { return _listName; } } private DataTable GetItems() { SPListItemCollection collJD = null; SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite site = new SPSite(SPContext.Current.Web.Url)) { using (SPWeb web = site.OpenWeb()) { SPList list = web.Lists.TryGetList(string.IsNullOrEmpty(_listName) ? HRConstant.listJDReferral : _listName); SPQuery query = new SPQuery(); //query.Query=string.Format("<Where><And><Contains><FieldRef Name=\"Title\" /><Value Type=\"Text\">{0}</Value></Contains><And><Eq><FieldRef Name=\"Job_Location\" /><Value Type=\"Choice\">{1}</Value></Eq><And><Eq><FieldRef Name=\"Level\" /><Value Type=\"Choice\">{2}</Value></Eq><Contains><FieldRef Name=\"Job_Department\" /><Value Type=\"Text\">{3}</Value></Contains></And></And></And></Where>",positionTitle,location,positionLevel,department); query.Query = string.Format("<Where><Eq><FieldRef Name=\"Status\" /><Value Type=\"Choice\">Open</Value></Eq></Where>"); query.ViewFields = "<FieldRef Name=\"Level\" /><FieldRef Name=\"Job_Location\" /><FieldRef Name=\"Title\" /><FieldRef Name=\"Job_Department\" />"; collJD = list.GetItems(query); } } }); } } }
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。