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

I want to develop a feature(-event receiver) to override default.aspx. I want to use a webpart-page instead and add some webparts. I don't know how to override it. I know how to build a new webpart-page, but I don't know how to find default.aspx and replace it.Could you please provide me the information I'm missing?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Have a look at these article, it also summarizes some of the most common approaches to have web part deployed on existing page or with a new page http://blogs.msdn.com/b/uksharepoint/archive/2011/04/04/provisioning-web-parts-to-a-page.aspx

Also using the AllUsersWebPart is the prefered approach for Page Layouts in Publishing site, also known as declarative (versus writing code in a feature receiver to inject it into a page) - see here for more http://dotnetmafia.sys-con.com/node/1046923/mobile

Waldek goes into more details if you prefer still the programatic approach http://blog.mastykarz.nl/provisioning-web-part-instances-in-a-structured-and-repeatable-way/ or to insert it direclty in a an existing RTE zone http://blog.mastykarz.nl/programmatically-adding-web-parts-rich-content-sharepoint-2010/

share|improve this answer
    
Thank you, but none of these articles shows how to override default.aspx. They tell me how to build pages and add webparts. I'm using SP-Foundation, so I don't have publishing sites. –  Stefan Hennicken Feb 20 '13 at 14:54
1  
Default.aspx is a web-part page by default in Team Sites, you could the exact same technique to 1. deploy your own Home.aspx - which would contain all web parts or add them programatically (by example), 2. Delete Default.aspx 3. set your page as the new Welcome (default) page for the site. Code routines to add Web parts to page are almost the same in Publishing/Web-Part pages. –  C. Marius - MVP Feb 20 '13 at 15:20
    
That sounds pretty similar to my expectations. But is it possible to delete default.aspx and save a new webpartpage as default.aspx? I don't want to save it in a doclib to avoid long urls and I don't want to use the standard default.aspx, because I customized the webpart-page-template and need the customizations in my landing-page. Of course I could set any page as the site's default-page but that changes the url. I want my landing-page similarto "hxxp://myspsite/subsite/default.aspx". I want to avoid something like "hxxp://myspsite/subsite/doclib/default.aspx". How do I achieve this? –  Stefan Hennicken Feb 21 '13 at 9:06
1  
yes, that too! the major issue is that you cannot delete THE page that is set as Welcome page. That is why you have to go through creating a new one prior to deleting the Default –  C. Marius - MVP Feb 21 '13 at 16:42
    
Did I get you right? There is no way to create a new page called "default.aspx" and located in the website-root? Or is it possible to do something like this? 1. create new webpart-page somewhere. 2.set it as the landingpage 3. delete default.aspx 4 create new default.aspx 5 set it as the landing page? Thanks a lot for your help in advance! –  Stefan Hennicken Feb 22 '13 at 8:20
show 2 more comments

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.