Wss3sdk: How to customize Field Rendering on the Mobile Page

Source: Internet
Author: User

This section provides an overview of the Field Rendering customization process on the mobile device access page of Windows SharePoint Services 3.0. For detailed steps, see the subsequent drills.

As we mentioned in the previous section on mobile page rendering mechanismSpmobilelistfieldselectorThe template selector control can be called in a chain starting from the control.

Based on the current list type and field (such as the notification and title in this example), this object determines whichRenderingtemplateThis field is used to render the field on the Mobile Display page.

This control will look for mobilecustomlistfield _Listtypeid_Fieldtype_FieldOfRenderingtemplate.

FieldtypeIs the Data Type of the field. You canSpfieldtypeAny value in the enumerated value, such as text or number. He can also beFldtypes *. xmlThe file uses the <field name = "typename"> element to customize the field type.

FieldIs the internal name of the field, such as workphone. If this field is part of the listSchema. xmlThe internal name of the List Schema Definition file can be found in the name attribute of the field element. The file is located in the directory: Local_drive:\Program Files \ common files \ microsoft shared \ Web Server Extensions \ 12 \ template \ Features \Feature_folder. If the field is added to the list through the UI; or by creating a column pageFieldYesMicrosoft. Sharepoint. spfield. internalnameAttribute value, which can be obtained through the object model.

Note::

Field is the internal name of a field (Column). It is not necessarily the same as the display name of the field. For fields created through the UI, the internal name is generated by the system based on the display name entered by the user (in the column Name text box on the create bar page. If this user contains spaces or punctuation characters in the display nouns, the mobile template rendering mechanism will not be able to use the internal names it generates, so you will not be able to customize such fields.

ListtypeidIt can be the ID of the current list type (such as 105), or a value of the splisttemplatetype enumeration (such as contacts ). There are two ways to define a list type ID:

    • If the list is part of the website typeONET. xmlIfListtypeidThe value is in ONet. xml.ListElementTypeAttribute Value. The file is located in this directory:Local_drive: \ Program Files \ common files \ microsoft shared \ Web Server Extensions \ 12 \ template \ sitetemplates \Site_type\ XML

    • If the list is added to the website through the UI, that is, by creating a new (list) pageListtypeidID of the basic list type used as the new list type. This depends on the user's click on the create. ASPX page, which list type is clicked to enter the new page.

If the ID of the specified renderingtemplate element is not foundMobiledefalistlistfield.

Existing renderingtemplate

After WSS is installed, the following two renderingtemplates used for field rendering already exist in mobiledefatemplates. ascx.

    • Mobilecustomlistfield_contacts_text_workphone

    • Mobilecustomlistfield_contacts_text_homephone

    • Mobilecustomlistfield_contacts_text_cellphone

    • Mobilecustomlistfield_contacts_text_email

    • Mobilecustomlistfield_picturelibrary_computed_imagesize

    • Mobilecustomlistfield_posts_datetime_publisheddate

You should not modify thisMobiledefatemplates. ascxFile. You can create a new renderingtemplate element (in your own. ascx file) only by using the same ID as an existing render control. However, this operation poses a risk and may damage other solutions deployed in WSS that depend on the original renderingtemplate object.

Note::

The rendering control that comes with WSS 3.0 is loaded before the custom control. Therefore, when a custom control with the same ID exists, the loading of the control template will overwrite the original control. If there are two or more custom control templates with the same ID, the names listed in alphabetical order will overwrite all others. If the specified file contains two or more rendering templates with the same ID, they will not be loaded.

In addition, the defaultRenderingtemplateThat is, the ID isMobiledefalistlistfiledObjects are also defined inMobiledefatemplates. ascxFile. If the rendering template defined for the current list type or field is not found at run time, the template is used. If you createRenderingtemplateIf the object uses this ID, the risks mentioned above also exist.

Customize part of the mobile list view or form
    1. In Microsoft Visual Studio, notepad, or any text editor, create a user control file (. ascx) and place it in the path\ Program Files \ common files \ microsoft shared \ Web Server Extensions \ 12 \ template \ controltemplates.

    2. Add several page tags to the file to register and reference the corresponding namespace.

    3. Add a rendering control to the. ascx file with the ID in this format:Mobilecustomlistfield _Listtypeid_Fieldtype_Field.
      TheListtypeid,Fieldtype,FieldFor the value, see the preceding section.
      In your rendering template, you can directly declare some rendered controls, such as label controls. It can also be defined through inheritanceSpmobilebasefieldcontrolClass to define a rendering control.

    4. Save the. ascx file and restart IIS to make the change take effect.

Example

The following renderingtemplate definition example shows how to create a new title field for the list items in the notification list.

< SharePoint: renderingtemplate Runat = "Server" ID ="Mobilecustomlistfield_announcements_text_title"   >
  < Template >
  < Mobile: Label Text ="Title field in announcements list" Runat = "Server"   />
  </ Template >
</ SharePoint: renderingtemplate >

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.