locked
How to display records from choice column in multilines instead of seperated by commas? RRS feed

  • Question

  • I have custom display aspx form. One of the column is CHOICE type - Checkboxes (allow multiple selections). When I pick up few selections, then in display.aspx they are seperated by comma. Is there any way, to make them display in seperated lines (multilines)?
    Monday, February 28, 2011 10:09 AM

Answers

  • Thanks for reply.

    I use Sharepoint designer. I create new list and I add new column - type: choice,Checkboxes (allow multiple selections) .

    In display.aspx, records in that column (marked couple of them) are seprated by semi-colon (";"). I want to display them, each in new line.

    I attach image: http://img13.imageshack.us/img13/8814/testyvc.jpg

     

    EDIT:

    Ok, I found the solution (http://www.mindsharpblogs.com/wayne/archive/2005/06/13/494.html)

    I added this code (replace ", " with <br>):

    <xsl:template name="break">
     <xsl:param name="text" select="."/>
     <xsl:choose>
      <xsl:when test="contains($text, ', ')">
       <xsl:value-of select="substring-before($text, ', ')"/>
       <br/>
       <xsl:call-template name="break">
       <xsl:with-param name="text" select="substring-after($text, ', ')"/>
       </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
       <xsl:value-of select="$text"/>
      </xsl:otherwise>
     </xsl:choose>
    </xsl:template>
    

    and replaced

    <xsl:value-of select="@test"/>

    with

    <xsl:variable name="test" select="@test"/>
    <xsl:call-template name="break">
    <xsl:with-param name="text">
    <xsl:value-of xmlns:xsl="http://www.w3.org/1999/XSL/Transform" select="$test"/>
    </xsl:with-param>
    </xsl:call-template>
    

    • Marked as answer by simon17 Tuesday, March 1, 2011 1:31 PM
    Tuesday, March 1, 2011 12:47 PM

All replies

  • Hi,

    Thanks to share your post.

    For the issue, I cannot catch the exact workarounds by your description. More detailed operation environment is needed. It would be highly appreciated that if you could tell me where do you use the display aspx form, what’s the function do you want to achieve, and what tool do you select to edit this, SharePoint designer or Visual Studio?

    In my scenario, I just choose to insert the asp.net controls-> checkbox list to the aspx page.  And save the page, it works ok.

    Hope this could help you!

    Leo

    Tuesday, March 1, 2011 9:25 AM
  • Thanks for reply.

    I use Sharepoint designer. I create new list and I add new column - type: choice,Checkboxes (allow multiple selections) .

    In display.aspx, records in that column (marked couple of them) are seprated by semi-colon (";"). I want to display them, each in new line.

    I attach image: http://img13.imageshack.us/img13/8814/testyvc.jpg

     

    EDIT:

    Ok, I found the solution (http://www.mindsharpblogs.com/wayne/archive/2005/06/13/494.html)

    I added this code (replace ", " with <br>):

    <xsl:template name="break">
     <xsl:param name="text" select="."/>
     <xsl:choose>
      <xsl:when test="contains($text, ', ')">
       <xsl:value-of select="substring-before($text, ', ')"/>
       <br/>
       <xsl:call-template name="break">
       <xsl:with-param name="text" select="substring-after($text, ', ')"/>
       </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
       <xsl:value-of select="$text"/>
      </xsl:otherwise>
     </xsl:choose>
    </xsl:template>
    

    and replaced

    <xsl:value-of select="@test"/>

    with

    <xsl:variable name="test" select="@test"/>
    <xsl:call-template name="break">
    <xsl:with-param name="text">
    <xsl:value-of xmlns:xsl="http://www.w3.org/1999/XSL/Transform" select="$test"/>
    </xsl:with-param>
    </xsl:call-template>
    

    • Marked as answer by simon17 Tuesday, March 1, 2011 1:31 PM
    Tuesday, March 1, 2011 12:47 PM