I have a few theoretical questions about a web part of all which are very basic and should be easy for someone to answer. I just need to make sure I understand how this stuff works better. I created a VISUAL
Web Part in VS 2010 for an SP 2010.
target was a subsite. Mydomain/Northwind rather than the root site.
Set to a farm solution rather than sandboxed.
My initial deployment scope was site but maybe it should have been web as this WP only performs a search of a specific list. So the feature shows up under site collection features, rather than the features of the specific subsite (web) that was the deployment target.
Web Part shows up under custom gallery as it should when I go to insert it in a page inside the subsite
Web part works as intended on the correct site but if I add it to a page on the root site, it bombs because it can't find the list in question because the list exists in the subsite
Using SPList shippers = SPContext.Current.Web.Lists["Shippers"];
All of this makes sense to me so far. So maybe the problem is that I should have made this scoped to web,
If I scope it to web, does that only mean that the same feature will show up on all sites (web) in the site collection under each site's feature section? I would rather that this only show up in the features of the specific subsite I targeted in the deployment because it will bomb if it is used on other sites
Deacativated the feature under site collection features where it is found
Deleted the web part from the page
The web part still shows up in the gallery and if I re-add it to the page it works as long as I use it in the subsite that contains the list it is supposed to search.
Why? I thought it wouldn't be available in the gallery if it is deactivated, and I didn't expect to not only find it there, but also be able to re add it, but I did and the web part works.
I don't want this available for addition to pages on other sites where that list it is searching will not be present. So after deleting it from the page once again, double checking that it was still deactivated under site collection features where it shows up, I went back to my project, kept the target location the same but changed the scope to web.
VS tells me that I cannot deploy the project through a feature with a web scope. Why not?
Hopefully some very easy questions. Thanks in advance.