It’s actually a bit more complicated than the title. I’m trying to figure out how to pass my own predefined url plus an ID from an XML source– all as an href in an anchor tag.
Basically, I have a XML source with different titles and ID’s:
<root>
<mainNode>
<title>ABC</title>
<ID>100</ID>
</mainNode>
<mainNode>
<title>DEF</title>
<ID>101</ID>
</mainNode>
</root>
I’m passing the Title to a repeater and want there to be an anchor tag as follows:
<asp:Repeater ID="xPathRepeater" runat="server">
<ItemTemplate>
<li>
<h1><%#XPath ("title") %></h1> <!--In the first case "ABC" -->
<a href="preDefinedPathInCodeBehind.aspx?100>Read More...</a>
</li>
</ItemTemplate>
</asp:Repeater>
Where 100 would be the ID I’m getting from the XML source.
I have no clue how to do this.
Here is my code behind:
protected void XMLsource()
{
string URLString = "http://ExternalSite.com/xmlfeed.asp";
XmlDataSource x = new XmlDataSource();
x.DataFile = URLString;
x.XPath = String.Format(@"root/mainNode");
xPathRepeater.DataSource = x;
xPathRepeater.DataBind();
}
Any help would be appreciated. Thank you so much!
I think this is what you are asking for?