I have a web part that works in the development environment, but when it is put into production, it doesn't error out, but it does not get any data from the list.
Here's the scenario:
I have many sites in my site collection. In each of these, I have a 'Site Administration' list, with data specific to that site (Sponsor/Project Manager, start date, etc.).
Then, under each of these sites, I have an 'About Us' subsite. My web part pulls data from the list and displays it on the right side of the page. In DEV, it works find, but in PROD, nothing is showing up. Permissions on the list are basically READ for all NT authenticated users. I'm posting the code below (with only a couple of items to keep it short).
Does anyone have any ideas why this is happening or where I could start troubleshooting?
protected void Page_Load(object sender, EventArgs e) { SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite site = new SPSite(SPContext.Current.Web.ParentWeb.Url)) { using (SPWeb web = site.OpenWeb()) { SPList listAboutUs = web.Lists.TryGetList("Site Administration"); if (listAboutUs != null) { if (listAboutUs.Items.Count != 0) { // it definitely gets inside here, because the 'false'
//text in each item is displayed with no errorSPListItem listItem = listAboutUs.Items[0]; lblStatus.Text = (!string.IsNullOrEmpty(Convert.ToString(listItem["Project Phase"]))) ? Convert.ToString(listItem["Project Phase"]) : "N/A"; lblProjectManager.Text = (!string.IsNullOrEmpty(Convert.ToString(listItem["Project Manager"]))) ? Convert.ToString(listItem["Project Manager"]) : "No manager found"; } } } } }); }