2

I need guidance/suggestions developing an app which will be hosted in SharePoint using external content types. So far I have a BDC model which works fine for reading the data und displaying it in an external list. Views can be build, filters can be set, columns can be sorted. Nice feature.

But editing or creating items with the built-in form does not satisfy my needs. At the time I have following requirements. It should be possible to have a control like the one which is rendered for the multi lookup field because in my app domain there are entities who have a n to m association between them.

Error messages of complex validations which are performed at the backend (web service, database, ...) should be user friendly displayed in the form. Built-in forms show an ugly BDC exception error message.

Some complex validation can and should be performed in the client. An example for this is that the values of two fields cannot be equal. This saves unnecessary round trips to the backend.

There is also a requirement for a master detail drop down list. Whenever the selected item in the master drop down list changes the items in the detail drop down list have to change.

These all are no problems with application pages. As far as I know application pages could not be used as form pages.

My understanding is that I have to build a custom web part, which will be used by the NewForm.aspx, EditForm.aspx, and DispForm.aspx forms. The web part can perform logic such as retrieving an entity and its related entities, rendering or adding controls, etc. But Microsoft says in a note at How SharePoint Forms Work:

Although it is possible to add Web Parts to the Display, Edit, and New forms for list items (DispForm.aspx, EditForm.aspx, and NewForm.aspx), doing so is not recommended or supported in SharePoint Foundation. Adding Web Parts to list view pages (AllItems.aspx) is supported.

So there is only one way left over? Creating custom form templates, field controls, and rendering templates to achieve my requirements.

Has anyone done this sort of work? Which way should I go?

2 Answers 2

2

I know it's too late to respond but I just wanna share here for later reference, for guys who have no idea how to customize the form for External List by using Visual Studio.

I had to google a lot to customize the (Display, Edit, New) forms for External List but there was nothing which could help me to fully customize and replace default forms by application pages. However, by combining few approaches I can now fully customize forms for BCS External List.

This guidance is based on this great article which shows you how to customize forms for normal SP lists. Please have a look at this google doc file: https://docs.google.com/file/d/0BwAyIaJP8PKxeUxBV20tcW1wX28/edit?usp=sharing&pli=1

0

Take a look at this question. You need to create custom form for your external list. Custom form will be implemented as rendering template which is .ascx file with your own (any) logic. To create external list with custom schema use ListInstance with CustomSchema attribute (or you can create custom list definition based on external list) - this is part of my code for external list with custom schema:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <ListInstance FeatureId="{00bfea71-9549-43f8-b978-e47e54a10600}" 
                TemplateType="600" 
                Title="Repository" 
                Description="" 
                Url="Lists/Repository" 
                CustomSchema="RepositoryList\Files\Schema.xml" 
                RootWebOnly="FALSE">
    <DataSource>
      <Property Name="LobSystemInstance" Value="RepositoriesBCSModel" />
      <Property Name="EntityNamespace" Value="BSCLinqToSql.Data.Entities" />
      <Property Name="Entity" Value="Repository" />
      <Property Name="SpecificFinder" Value="ReadItem" />
    </DataSource>
  </ListInstance>
</Elements>

Your lob system of course should be present to make it work.

6
  • Thank you Kai. I knew ListInstance with CustomSchema. It worked for me. But replacing a form's template with a custom template or with another built-in template did not work. The list's forms always used the ListForm template. But that is another story. I would like to know wether you have built custom forms with rendering templates. How did it go for you?
    – Yavuz
    Feb 7, 2013 at 16:53
  • Replacing is work for me, you just need to create rendering template and place it directly in _controltemplates folder (not in subfolder!). If this is not working for you, you may try to create your own page, place it near list schema and update schema with <Form Type="NewForm" Url="NewForm.aspx" SetupPath="features\$SharePoint.Feature.DeploymentPath$\RepositoryList\Files\NewForm.aspx" WebPartZoneID="Main" /> Feb 8, 2013 at 8:09
  • OK let's go the template way :) But it does not work :( I have added CustomTemplate.ascx with no code. Copied the rendering template ListForm into it and renamed it to ListForm2222. Schema.xml with <Form Type="DisplayForm" Url="DispForm.aspx" Template="ListForm2222" SetupPath="features\$SharePoint.Feature.DeploymentPath$\Coworkers\FormPage.aspx" WebPartZoneID="Main" /> or <Form Type="DisplayForm" Url="DispForm.aspx" Template="ListForm2222" SetupPath="pages\form.aspx" WebPartZoneID="Main" /> both do not work. Looking with SP Manager I always see ListForm as template not ListForm2222.
    – Yavuz
    Feb 8, 2013 at 10:19
  • Does content types enabled for your list? Feb 8, 2013 at 10:24
  • With content type definition in the schema (<FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms"><Display>ListForm2222</Display> ...) and also without content type definition both do not work. I have noticed that when I remove CustomSchema attribute from ListInstance then the list is shown in the quick launch otherwise not.
    – Yavuz
    Feb 8, 2013 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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