Question

I was asked to add a list view web part to an application page.

I added a web part zone into the page markup. I got a security error when I tried to add it so I added a form digest control (not sure if that was correct, but it changed the error). The next errors were about the list being hidden, and after searching I found that it's because of the view having a BaseIndexID(?) of 1 (which needs to be 0), and that value is read only programmatically.

I'd like to avoid having to add any more files to the VS project. The lists were created through the site, meaning I don't have list definitions in the project.

I've had it with this today so I hoping someone can give me guidance/put me on the right track. This is for MOSS2007 and publishing is disabled.

Was it helpful?

Solution

Placing webparts to application pages (i.e. within _layouts folder) actually is not a very good idea, especially when it comes to OOTB SharePoint webparts. Personally, I'd prefer to avoid this, because although it's possible, but AFAIK it is not officially supported by Microsoft and there are some known issues, for example I can recall the XsltListViewWebPart bug with XLST files caching, etc.

Thus I'd recommend you to consider using ListViewByQuery control instead of list view webparts.

ListViewByQuery Class

Renders a list view within a Web Part or ASPX page according to a specified query.

OTHER TIPS

You can use webparts on your application page. They won't be customizable then, but they are put on the page as webcontrols:

register your namespace that your webpart resides in:

<%@ Register TagPrefix="prefix" Namespace="YourNameSpace" Assembly="Assembly" %>

Then add your webcontrol by using the following code:

<prefix:WebPartClassName ID="ID" FrameType="None" runat="server" __WebPartId="webpartGuid" WebPart="true" />

success on it!

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top