I've been trying for several days now to figure out how to programmatically associate a custom form with an external list. Currently I'm creating an external content type + external list programmatically (in Visual Studio) when my feature activates. I now want to define some custom forms for viewing/editing the list items in my external list. I cannot figure out the right approach to make this work. I can create and associate the custom forms with the external list in SharePoint Designer, so I know its possible, I just can't figure out how to do this in Visual Studio.
In Visual Studio I can provision an aspx file and have it deployed to my list's folder, but when I try to set that aspx file as the list's default display form it tells me the page is not a valid form. For example...
myList.DefaultDisplayFormUrl = "Lists/LocationsList/MyDisForm.aspx";
...will fail even though that page exists at that url. It think it fails because the list does not contain an item in its Forms collection with that url. All my attempts to modify the list's Forms collection have failed. It appears to be read-only.
Anyone have any ideas?
View Complete Post