I was wondering if I could acheive the following. I have a custom application page living in _layouts which displays an entity based upon an external content type item.

For external lists using this content type, I would like to set this page as the default view when a user clicks an item. I already have it as an action, but then the user has to click on the dropdown to find it, I want it to be really default.

I've tried using powershell (altering DefaultDisplayFormUrl), but that seems to only accept SPForm objects. For as far as I know, I can't create an SPForm object for pages in _layouts; right?

I also tried creating a new dispform page, copying my custom page content into that one and setting it as default, but I then get errors complaining about things like the masterpage attribute, autoeventwireup not being allowed, etc. etc.

What's a good option to acheive my goal?

  • I'm wondering if there is some way you could intercept the user visiting DispForm and redirect? – Kit Menke Sep 15 '11 at 20:51

In my experience, this would work best as a webpart. When editing the displayforms, to play nice with SP, you have to keep that listview webpart on the page. Fortunately, you can make it hidden. So, what I would do is create a webpart that duplicates the functionality of your application page. Edit the displayform page using the browser, edit the webpart that is currently on the page and make it hidden. Then add your webpart to the page.

I guess if you don't want to convert your code into a webpart, you could try to add a content editor webpart to the page, and do a javascript redirect to your application page. I'm not sure how that would work though.

  • Seems the best solution and is deployable programmatically too. Thanks! – Jasper Sep 16 '11 at 8:58

You should try setting the DisplayFormUrl property directly on the content type rather than on the list.


If your content type is created from a feature, you should set it directly in the markup:


  • Never mind, this doesn't apply for an external content type.. sorry! – Dennis George Sep 15 '11 at 17:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.