1 / 37

Advanced List Form Customization in WSS 3.0

I BP402. Advanced List Form Customization in WSS 3.0. Arthur Brost Portals and Collaboration Practice Manager twentysix New York. About Me. Arthur Brost Portals and Collaboration Practice Manager for twentysix New York twentysix New York Gold Managed Partner

clint
Download Presentation

Advanced List Form Customization in WSS 3.0

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. IBP402 Advanced List Form Customization in WSS 3.0 Arthur Brost Portals and Collaboration Practice Manager twentysix New York

  2. About Me • 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

  3. Session Summary • 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

  4. SharePoint List Forms • Used to display individual items • New, Display and Edit forms • Auto-generated based on list schema • Uses ListForm control template to layout the form.

  5. List Item FormCustomization Options • SharePoint Designer • Custom ASPX page • Modify Schema.Xml Form elements • Control Templates

  6. List Item Form CustomizationSharePoint Designer • Applies to single list instance • ListForm Web Part • Custom List Form control • New fields not automatically added

  7. Using SharePoint Designer

  8. List Item Form CustomizationCustom ASPX page • 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

  9. Specifying a Custom FormIn a Feature • <ListTemplate • Name="MyTemplate" • Type="2100" • … • NewPage="MyCreateList.aspx" EditPage="MyEditList.aspx“ • … • >

  10. Specifying a Custom FormIn a List Definition • <List Title="MyList"...> • <MetaData> • … • <Forms> • <Form • Type="DisplayForm“ • SetupPath="pages\form.aspx“ • Url="Forms/DispForm.aspx“ /> • ...

  11. List Item Form CustomizationSchema.XML • Supported in WSS 2.0 • Code form elements in CAML • Still supported in WSS 3.0 by using the UseLegacyForm attribute

  12. Schemal.Xml code • <Forms> • <Form Type="EditForm" Url="editform.htm"> • <ListFormOpening>…</ListFormOpening> • <ListFormButtons>… • </ListFormButtons> • <ListFormBody>…</ListFormBody>

  13. List Item Form CustomizationASP.NET Control Templates • 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

  14. Example Control Hierarchy

  15. Control Template..\12\Template\ControlTemplates\DefaultTemplates • <SharePoint:RenderingTemplate ID="ListForm" …> • <Template> • <SPAN id='part1'> • <SharePoint:InformationBarrunat="server"/> • <wssuc:ToolBar …> • <Template_RightButtons> • <SharePoint:NextPageButtonrunat="server"/> • <SharePoint:SaveButtonrunat="server"/> • <SharePoint:GoBackButtonrunat="server"/> • </Template_RightButtons> • </wssuc:ToolBar> • <SharePoint:FormToolBarrunat="server"/> • <TABLE …> • <SharePoint:ChangeContentTyperunat="server"/> • <SharePoint:FolderFormFieldsrunat="server"/> • <SharePoint:ListFieldIteratorrunat="server"/> • …

  16. Custom Template..\12\Template\ControlTemplates\MyTemplate.ASCX • … • <%@ Register • TagPrefix="MyControls" Assembly="MyControls, …” Namespace="MyControls" %> • … • <SharePoint:RenderingTemplate ID="MyListForm" …> • <Template> • … • <MyControls:ItemChildrenrunat="server" /> • … • </Template> • </SharePoint:RenderingTemplate> • …

  17. By List Defintion..\12\Features\MyList\My\Schema.xml • <List Name=“MyList“ …> • <MetaData> • … • <Forms> • … • <Form Type="NewForm" Template="MyListForm"…> • </Forms> • </MetaData> • </List>

  18. By Content Type..\12\Template\Features\MyType\Elements.xml • <ContentType ID="0x0126" Name="MyType" …> • … • <XmlDocuments> • <XmlDocument …> • <FormTemplates …> • <Display>MyListForm</Display> • <Edit>ListForm</Edit> • <New>ListForm</New> • </FormTemplates> • </XmlDocument> • </XmlDocuments> • </ContentType>

  19. Setting/Checking the Template from Code • //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(); • …

  20. Demo Scenario • Two lists: Photos, and Ratings • Multiple ratings per photo • Ratings contains a lookup to Photos

  21. Custom Item Template Customized List Item Form template demo

  22. ASP.Net Web Controls Custom ASP.NetWebControl on a List Item form demo

  23. List Field Iterator • Iterates fields • Used in various control templates • Override IsFieldExcluded for field level security

  24. Custom List Field Iterator Suppress fields based on user demo

  25. Custom Field Types • Field Type Definition • Render Pattern (CAML) • Field Class • Derived from SPField • Allows Custom Validation • Field Control • Derived from BaseFieldControl • Specifies Field Template

  26. Field Template • <SharePoint:RenderingTemplate ID="CustomFieldTemplate" ...> • <Template> • <asp:TextBox ID="TextField" ...> • Custom • </Template> • </SharePoint:RenderingTemplate>

  27. Field Control Class • [Guid("42FD6883-EA0D-43fb-9201-1443A348334B")] • public class MyFieldControl : Microsoft.SharePoint.WebControls.NumberField • { • … • protected override string DefaultTemplateName • { • get • { • return "CustomFieldTemplate"; • } • } • }

  28. Field Class • [Guid("2e0a281b-ef91-46ab-86f3-f6aadaa4da0e")] • public class MyField : SPFieldNumber • { • public MyField(SPFieldCollection fields, string fieldName) • : base(fields, fieldName) • … • public override BaseFieldControlFieldRenderingControl • { • … • get • { • BaseFieldControlfieldControl = new MyFieldControl(); • fieldControl.FieldName = this.InternalName; • return fieldControl; • } • } • }

  29. FLDTYPES_*.Xml..\12\Template\XML • <FieldTypes> • <FieldType> • <Field Name="TypeName">CustomType</Field> • <Field Name="ParentType">Number</Field> • <Field Name="TypeDisplayName">Custom Type</Field> • <Field Name="TypeShortDescription>Sample Custom Field Type</Field> • <Field Name="UserCreatable">TRUE</Field> • <Field Name="ShowInListCreate">TRUE</Field> • <Field Name="ShowInSurveyCreate">TRUE</Field> • <Field Name="ShowInDocumentLibraryCreate">TRUE</Field> • <Field Name="ShowInColumnTemplateCreate">TRUE</Field> • <Field Name="FieldTypeClass">MyNameSpace.MyField, MyAssembly, • Version=1.0.0.0, Culture=neutral, PublicKeyToken=b3e674199e6c34cb</Field> • <RenderPattern Name="DisplayPattern"> …

  30. AJAX Field Controls Custom Field Type Template Using AJAX demo

  31. Silverlight Controls Silverlight Controls on a List Item Form demo

  32. Useful Links • 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

  33. Contact Information • Arthur Brost Arthur.Brost@26ny.com • www.26ny.com

  34. Post Event DVD brought to you courtesy of:

  35. SUBMIT AN EVALUATION For a chance to win an 8GB ZUNE! Submit evaluations on MySPC www.MicrosoftSharePointConference.com

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

More Related