Friday, June 22, 2007

MOSS: Creating a Custom View Page

When you use the schema.xml to define a View on a List, each View must have a unique value for the Url attribute.  Typically this is in the format Url="/Forms/MyCustomView.aspx".

If you need to add special content or logic to your custom view page, you can simply

  1. Copy C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\Pages\viewpage.aspx into the same folder where you have your schema.xml file, and
  2. Rename it MyCustomView.aspx.
  3. In your List schema.xml file, in the View tag for your custom view, remove the SetupPath attribute.  This attribute would normally hijack the URL and point it to the Pages\viewpage.aspx
  4. Modify MyCustomView.aspx as needed
  5. Redeploy (as a feature or part of a solution - if the latter, don't forget to add MyCustomView.aspx to your solution's ddf file)

Labels: , ,


Post a Comment

<< Home