Let's say I have a single XML node of content in my code-behind. I need to get some data out of the various nodes and onto a Web form.
Traditionally, I would create a bunch of Literals on the page, then do stuff like this in the code-behind:
MyLiteral.Text = myXmlNode.SelectSingleNode("/some/xpath").InnerText;
This is fine and good, but consider the binding syntax we use in Repeaters:
<ItemTemplate>
<p>
<%# XPath("/some/xpath") %>
</p>
</ItemTemplate>
So, I got to wondering if you can use this same syntax for non-Repeater situations. It just seems odd that there wouldn't be the same syntax available for a non-iterating situation.
(Of course, if you didn't mind being ridiculous, you could bind your XML node to a Repeater, where it would only have one iteration. I swear I've never done this...)
I can't help but thinking that the designers of the framework would have planned for this. Is there some non-iterating control I don't know about that allows you to bind a datasource and render using data binding expressions?