views:

852

answers:

3

Hello all,

I try to create a custom webpart page. I tried a book example that start with :

<%@ Page MasterPageFile="~masterurl/default.master"
Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,
          Microsoft.SharePoint, [full 4-part assembly name]"
meta:progid="SharePoint.WebPartPage.Document" %>

....but no result.... The page is deployed into _layouts folder but when I try to access it from browser I get : "_layouts/~masterurl/default.master does not exist". What I do wrong ?

Thank you in advance !

Solved the problem : read again the book and indeed I did not have to add the page to _layouts folder. Thank you for opening my eyes :). All steps are well explain in the book but I was not concentrating enough. Yes, one down....

+1  A: 

Are you writing a web part page by hand? That is usually done automatically by creating a document library within a SharePoint site and then adding a web part page to it. In addition I'm not sure that Page directive is valid. Looking the source for an (automatically-generated) web part page, I have

<%@ Reference VirtualPath="~masterurl/custom.master" %>

But, again, I would encourage you to use the automatic creation of web part pages if that's possible for you.

strongopinions
In the book Inside WSS 3.0 at chapter 3, is a subtitle ("Designing Web Part Pages") with an example. This is what I want to do and for some unknown reason for me I fail.
Ciprian Grosu
+1  A: 

You first need to decide weather your page is going to be a Site Page (meaning it lives in a document library or directly in the Web), or if it is going to be an Application Page. If you deploy the page to the _layouts folder you're telling SharePoint this is an Application Page.

If you look at other _layouts pages, they have the format

<%@ Page language="C#" MasterPageFile="/_layouts/application.master"      Inherits="..." %>

You could change application.master to a different file then.

This is only one way to do this, however I believe that are other options depending on how dynamic you want the master page file to be.

Jon Schoning
+1  A: 

Jon is right, you can't make a web part page in the _layouts folder.. they don't have the web part infrastructure set up. You can only have application pages there. I'm sure your book doesnt tell you to put the web part page in the _layouts folder?

ArjanP