Is there a non-iterable control that allows the use of data binding syntax?

Let's say I have one XML content node in my code. I need to get some data from various nodes and in a web form.

Traditionally, I would create a bunch of literals per page and then do things like this in code:

MyLiteral.Text = myXmlNode.SelectSingleNode("/some/xpath").InnerText;

      

This is fine and good, but consider the binding syntax we use in relays:

<ItemTemplate>
    <p>
        <%# XPath("/some/xpath") %>
    </p>
</ItemTemplate>

      

So, I was wondering if you can use this syntax for non-repeater situations. It seems odd that there would be no syntax available for a situation without iteration.

(Of course, if you don't mind laughing, you can link your XML node to a relay where it will only have one iteration. I swear I never did that ...)

I can't help but think that the wireframe designers planned this. Is there an invalid control I am not aware of that allows you to bind a data source and render using data binding expressions?

0


a source to share


2 answers


As you already figured out, the data binding syntax only works with composite controls such as repeaters, lists, details, etc.



+1


a source


The best suggestion I can think of is using something like DetailsView or FormView. This will at least get rid of the "non-duplicate" data problem.



0


a source







All Articles