Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Lee 95 posts 115 karma points
    Nov 15, 2011 @ 12:00
    Lee
    0

    ASP.net form with XSLT data source

    Hi

     

    I have created a form which in ASP.net which I would like to place a DropDownList component.

    I then want to populate the list with a series of nodes using XSLT

    So I created my XSLT:

    <option value="{@id}"><xsl:value-of select="@nodeName"/> </option>

    I know want to add this to my ASP.NET page.

    After searching I found this snippet, but don't understand how I can link it up:

    <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="XmlDataSource1" 
    DataTextField="text" DataValueField="value"></asp:DropDownList>
    <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/App_Data/Users.xml"
    TransformFile="~/DropDownConverter.xsl"></asp:XmlDataSource>

    Any advice would be greatly received!


  • Michael Latouche 504 posts 819 karma points MVP 5x c-trib
    Nov 15, 2011 @ 13:38
    Michael Latouche
    0

    Hi Lee,

    Where are you getting the list items from? Are these Umbraco Nodes?

    One way of doing would be to put your XSLT logic to render the dropdownlist into a macro, and then integrate that macro in your ASP code.

    Hope this helps.

    Cheers,

    Michael.

  • Lee 95 posts 115 karma points
    Nov 15, 2011 @ 14:14
    Lee
    0

    They are child nodes, so how would you integrate the macro into the asp code?

     

    Thanks

  • Michael Latouche 504 posts 819 karma points MVP 5x c-trib
    Nov 15, 2011 @ 14:36
    Michael Latouche
    0

    Hi Lee,

    Let's say that you call your macro "MyListMacro", then you can integrate it in your asp code like this:

    <umbraco:Macro Alias="MyListMacro" runat="server"></umbraco:Macro>

    Cheers,

    Michael.

  • Lee 95 posts 115 karma points
    Nov 15, 2011 @ 15:51
    Lee
    0

    Cool...

    But I've got

    System.Xml.XmlException: 'asp' is an undeclared prefix. Line 20, position 7.

     

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:fulltextsearch.search="urn:fulltextsearch.search" xmlns:fulltextsearch.helper="urn:fulltextsearch.helper"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets fulltextsearch.search fulltextsearch.helper ">

    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

    <!-- The fun starts here -->
      <options>
    <xsl:for-each select="$currentPage/Vacancies [@isDoc]">

         <asp:ListItem><asp:value-of select="@nodeName"/></asp:ListItem>

    </xsl:for-each>
      </options>

    </xsl:template>

    </xsl:stylesheet>

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies