Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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!
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.
They are child nodes, so how would you integrate the macro into the asp code?
Thanks
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>
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 " "> ]><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>
is working on a reply...
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.
Continue discussion
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:
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!
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.
They are child nodes, so how would you integrate the macro into the asp code?
Thanks
Hi Lee,
Let's say that you call your macro "MyListMacro", then you can integrate it in your asp code like this:
Cheers,
Michael.
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 " "> ]>
<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>
is working on a reply...
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.