Arthur Brost Portals and Collaboration Practice Manager twentysix New York I BP402
Arthur Brost Portals and Collaboration Practice Manager for twentysix New York twentysix New York Gold Managed Partner Practices in Enterprise Integration, Business Intelligence and Portals and Collaboration
Customizing List Item Forms SharePoint Designer Custom ASPX page Schema.xml Control Templates HTML ASP.NET Server Controls Silverlight Controls List Field Iterator Custom Field Types AJAX Toolkit Controls
Used to display individual items New, Display and Edit forms Auto-generated based on list schema Uses ListForm control template to layout the form.
SharePoint Designer Custom ASPX page Modify Schema.Xml Form elements Control Templates
Applies to single list instance ListForm Web Part Custom List Form control New fields not automatically added
Specified in List Feature or Schema Same form as SharePoint Designer By Default no code allowed Adding Web Parts is possible but not recommended / supported
<ListTemplate Name="MyTemplate" Type="2100" … NewPage="MyCreateList.aspx" EditPage="MyEditList.aspx … >
… <Form Type="DisplayForm SetupPath="pages\form.aspx Url="Forms/DispForm.aspx />...
Supported in WSS 2.0 Code form elements in CAML Still supported in WSS 3.0 by using the UseLegacyForm attribute
… …
Combination of HTML and Child Controls Used by the ListForm Web Part Registered by list type or content type Stored in …\12\TEMPLATE\CONTROLTEMPLATES May override default templates
DocumentLibraryFormDocumentLibraryFormCoreDocumentLibraryFieldsCompositeField NumberField
…
Register TagPrefix="MyControls" Assembly="MyControls, … Namespace="MyControls" %> … … … …
… …
… MyListForm ListForm
//List … SPList list = web.Lists["MyList"]; String NewFormTemplate = list.Forms[PAGETYPE.PAGE_NEWFORM].TemplateName ; //Content Type SPContentType type = list.ContentTypes[0]; String NewFormTemplate = type.NewFormTemplateName; type.NewFormTemplateName = "MyListForm"; type.Update(); …
Two lists: Photos, and Ratings Multiple ratings per photo Ratings contains a lookup to Photos
Customized List Item Form template demo
Custom ASP.Net WebControl on a List Item form demo
Iterates fields Used in various control templates Override IsFieldExcluded for field level security
Suppress fields based on user demo
Field Type Definition Render Pattern (CAML) Field Class Derived from SPField Allows Custom Validation Field Control Derived from BaseFieldControl Specifies Field Template
Custom
[Guid("42FD6883-EA0D-43fb A348334B")] public class MyFieldControl : Microsoft.SharePoint.WebControls.NumberField { … protected override string DefaultTemplateName { get { return "CustomFieldTemplate"; }
[Guid("2e0a281b-ef91-46ab-86f3-f6aadaa4da0e")] public class MyField : SPFieldNumber { public MyField(SPFieldCollection fields, string fieldName) : base(fields, fieldName) … public override BaseFieldControl FieldRenderingControl { … get { BaseFieldControl fieldControl = new MyFieldControl(); fieldControl.FieldName = this.InternalName; return fieldControl; }
CustomType Number Custom Type Sample Custom Field Type TRUE MyNameSpace.MyField, MyAssembly, Version= , Culture=neutral, PublicKeyToken=b3e674199e6c34cb …
Custom Field Type Template Using AJAX demo
Silverlight Controls on a List Item Form demo
Creating Custom Form Templates How to: Create a Custom Control for a Form How to: Create a Custom Field Type and Field Control Walkthrough: Creating a Custom Field Type
Arthur Brost
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.