Thursday, October 31, 2013

How to change webpart code to point to List created under a particular site

create new SPWeb object



SPWeb sales=SPContext.Current.Site.OpenWeb("Sales")
SPList list=sales.Lists["ListName"]



the code above is given that sales site is under the root site of site colleciton




Hope that helps|Amr Fouad|MCTS,MCPD sharePoint 2010


No comments:

Post a Comment