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

Is it possible to include multiple web part in ASCX page. My ASCX page is very simple and it only includes tabbed navigations, inside those tabs I would like to embed web parts. Code below does not work, any suggestions.

<table cellpadding="4" cellspacing="0" border="0" width="100%">
            <tr>
                <td id="_invisibleIfEmpty" name="_invisibleIfEmpty" valign="top" height="100%"> 
                <div id="tabs">
<ul>
    <li><a href="#tab-1"><span>Weather</span></a></li>
    <li><a href="#tab-2"><span>Stock</span></a></li>
</ul>

share|improve this question
1  
There are no web parts nor even zones in the sample code so it is hard to tell why it is not working –  Dave Wise Feb 24 '12 at 18:03
1  
Do you mean ASPX, or are you really creating a user control? In that case, you should review your design because this might not be the best option for you. –  Jasper Oct 10 '12 at 8:38
add comment

4 Answers 4

Every visual web part uses some ascx control. It is located in Program files... \ControlTemplates\FeatureName\WebPartName\WebPartName.ascx . Therefore you can use not webpart but ascx control from this web part.

Hope it will help you.

share|improve this answer
add comment

If you are trying to add webparts to a static aspx page, you'll have to register the webpart control on top, then put the control where you want. Check this out: http://msdn.microsoft.com/en-us/library/sbz9etab(v=vs.100).aspx

I'm pretty sure this should work for webparts.

share|improve this answer
add comment

If you just want to use tabs, its good to go for a lightweight html control. Checkout the jquery tab plugin : http://jqueryui.com/demos/tabs/

You can easily edit the markup and can insert webpart zones where needed. Then you can add your webparts.

share|improve this answer
add comment
  1. There are no zones.
  2. You can't put zones in a ascx page
  3. Yes you can put webparts in your ascx, but they are going to be static. Meaning you cannot edit them in edit mode on your website. You need configurate them in the source code.

This can be done by using SharePoint Designer, inserting a webpart to a pagelayout and configure it there, then go to Code view and copy the html and then paste it into your .ascx page.

share|improve this answer
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.