Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Classic SharePoint quandry, but so far the resources I've looked at haven't helped.

On one hand, application pages work perfectly, but having them live in the 14 hive isn't ideal for a number of reasons.

On the other hand, you can have a Web Part Page with a pre-embedded Visual Web Part, and you have a lot of the same functionality.

Problem is, I'm trying to build a product, and as far as I can tell you can't have web parts that don't show up on the menu.

I really don't want people being able to embed these code fragments at will, plus it just looks sloppy.

Is there any way to have an application page that lives in the site root, or a document library? I've seen ways to attach a code file to a web page, but then you can't interact with controls, etc...

Regardless of the post title, goal is to have a page that lives in the site, not the 14 hive, that can run custom code to render HTML based on settings and such living in lists.

* EDIT *

Here is how it is now on the page:

<%@ Register TagPrefix="WpNs0" Namespace="Namespace.WebParts.CodeLoader" Assembly="Namespace, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f3223936ce445e13"%>

<WebPartPages:WebPartZone runat="server" Title="PanoramaConfig" ID="PanoramaConfig" AllowLayoutChange="FALSE"><ZoneTemplate>
<WpNs0:CodeLoader runat="server" ID="g_ad1eb52a_6902_463b_9d44_77afd52fc056" Description="My Visual WebPart" ChromeType="None" Title="CodeLoader" __MarkupType="vsattributemarkup" __WebPartId="{AD1EB52A-6902-463B-9D44-77AFD52FC056}" WebPart="true" __designer:IsClosed="false" partorder="2"></WpNs0:CodeLoader>
</ZoneTemplate></WebPartPages:WebPartZone>

So I can deploy the ASCX file without the .webpart? I'll give it a shot and mark answer if it works. If not you can take a look at the above and recommend from there.

share|improve this question
add comment

3 Answers 3

up vote 1 down vote accepted

You can have webparts that don't show up in the menu. If you don't deploy the .dwp or .webpart file to the webpart gallery, then your webpart won't show up.

I have a few admin webparts that I do this way. I just keep the .dwp or .webpart file on my local computer, and when I need to use them I just upload the file to the page and configure it.

You can also set the exportmode (http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.webpart.exportmode.aspx) to None so that no one can export your webpart through the browser. They still might be able to through SP designer though.

share|improve this answer
    
Marked you since yours was technically more correct. I was able to deploy the solution without even having a .webpart file and the code renders just fine. –  Wesley Jun 28 '12 at 4:45
add comment

You can also look at using user controls instead of webparts. These user controls can be added to a page layout and you can create the pages using this layout. You can access control the page layouts so that not all users can use this page layout.

share|improve this answer
    
Can I do this in a predictable form that can be referenced and deployed automatically in a simple Site Definition WSP? –  Wesley Jun 28 '12 at 5:13
    
You can create this page layout and deploy through a feature. This feature could be included in you site definition. –  Manju Jun 28 '12 at 6:54
add comment

Is your product setting itself up (i.e. adding pages and creating web parts programatically in the correct place?). If so, could you just delete the .webpart files from the webpart gallery when it has finished creating.

share|improve this answer
    
See my edits, too long to put into comment –  Wesley Jun 28 '12 at 4:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.