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 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.

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

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.

share|improve this answer
add comment

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!

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.