SharePoint: Extended DVWP-Part 2: Enhanced Layout-Rearrange columns in the insert Template

Source: Internet
Author: User
Tags xsl
Document directory
  • 1. Switch the view
  • 2. Find the Template
  • 3. Edit the Template
  • 4. Check the Display Effect

In the previous blog, we added the Edit/delete link from the left to the right in DVWP. If we enable the insert link in DVWP, we also need to do the same in the insert template.

1. Switch the view

Switch to the insert template. You can click the right angle bracket icon in the upper-right corner (displayed when you move the cursor over the webpart in the design view ).

Select Insert template for preview

It is certain that it will have the same error bit as editing the template:

2. Find the Template

In this case, we will find a template named dvt_1.rowinsert. Click a field in the design view (as long as the link is not saved or canceled) to locate the template in the Code view:

<Xsl: template name = "dvt_1.rowinsert"> <xsl: param name = "IsInsertMode"/> <xsl: variable name = "Pos"> _ new </xsl: variable> <tr> <xsl: choose> <xsl: when test = "$ IsInsertMode = '1'"> <xsl: if test = "$ dvt_1_automode = '1'" ddwrt: cf_ignore = "1"> <td class = "ms-vb" width = "1%" nowrap = "nowrap"> <xsl: call-template name = "dvt_1.automode"> <xsl: with-param name = "KeyField"> ID </xsl: with-param> <xsl: with-param name = "KeyValue" select = "ddwrt: EscapeDelims (string (@ ID)"/> <xsl: with-param name = "Mode"> insert </xsl: with-param> </xsl: call-template> </td> </xsl: if> <td class = "ms-vb"> <SharePoint: formField runat = "server" id = "ff2 {$ Pos}" ControlMode = "New" FieldName = "Title" _ designer: bind = "{ddwrt: dataBind ('I', concat ('ff2', $ Pos), 'value', 'valuechanged ', 'id', ddwrt: EscapeDelims (string (@ ID )), '@ title')} "/> <SharePoint: fieldDescription runat = "server" id = "ff2description {$ Pos}" FieldName = "Title" ControlMode = "Edit"/> </td> <td class = "ms-vb"> <xsl: value-of select = "@ Editor" disable-output-escaping = "yes"/> </td> <td class = "ms-vb"> <xsl: value-of select = "ddwrt: FormatDate (string (@ Modified), 2052, 5)"/> </td> </xsl: when> <xsl: otherwise> <td class = "ms-vb" colspan = "99"> <a href = "javascript: {ddwrt: GenFireServerEvent ('_ cancel; dvt_effecform_insertmode = {1} ')} "> insert </a> </td> </xsl: otherwise> </xsl: choose> </tr> </xsl: template>
3. Edit the Template

Similarly, we move the call of this template to the bottom of the entire Section so that it is displayed at the rightmost of the list:

 

<Xsl: template name = "dvt_1.rowinsert"> <xsl: param name = "IsInsertMode"/> <xsl: variable name = "Pos"> _ new </xsl: variable> <tr> <xsl: choose> <xsl: when test = "$ IsInsertMode = '1'"> <td class = "ms-vb"> <SharePoint: formField runat = "server" id = "ff2 {$ Pos}" ControlMode = "New" FieldName = "Title" _ designer: bind = "{ddwrt: dataBind ('I', concat ('ff2', $ Pos), 'value', 'valuechanged ', 'id', ddwrt: EscapeDelims (string (@ ID )), '@ title')} "/> <SharePoint: fieldDescription runat = "server" id = "ff2description {$ Pos}" FieldName = "Title" ControlMode = "Edit"/> </td> <td class = "ms-vb"> <xsl: value-of select = "@ Editor" disable-output-escaping = "yes"/> </td> <td class = "ms-vb"> <xsl: value-of select = "ddwrt: FormatDate (string (@ Modified), 2052, 5)"/> </td> <xsl: if test = "$ dvt_1_automode = '1'" ddwrt: cf_ignore = "1"> <td class = "ms-vb" width = "1%" nowrap = "nowrap"> <xsl: call-template name = "dvt_1.automode"> <xsl: with-param name = "KeyField"> ID </xsl: with-param> <xsl: with-param name = "KeyValue" select = "ddwrt: EscapeDelims (string (@ ID)"/> <xsl: with-param name = "Mode"> insert </xsl: with-param> </xsl: call-template> </td> </xsl: if> </xsl: when> <xsl: otherwise> <td class = "ms-vb" colspan = "99"> <a href = "javascript: {ddwrt: GenFireServerEvent ('_ cancel; dvt_effecform_insertmode = {1} ')} "> insert </a> </td> </xsl: otherwise> </xsl: choose> </tr> </xsl: template>
4. Check the Display Effect

Because we have edited the Code, when we return to the design view, we will switch back to the default template. After we switch back to the insert template, we will see the effect as shown in:

Achieve the goal. The Link Used for the insert operation is moved to the right of DVWP.

Shows the final page layout of the inserted template:

Insert template:

Default template:

In the following expanded DVWP article, we will discuss how to convert an operation link to a button.

References

SharePoint: Extending the DVWP-Part 2: Layout Enhancement-Rearranging Columns-Insert Template

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.