Reputation: 14934
I've an ASP.NET Repeater, where a DataView with values name and value is binded.
Displaying my datasource in the below works fine:
<asp:Repeater runat="server" OnItemDataBound="Repeater_OnItemDataBound" ID="MyRepeater">
<ItemTemplate>
<%# Eval("name") %><br/>
<%# Eval("value") %><br/>
</ItemTemplate>
</asp:Repeater>
Instead I would like to add the values to a Label and a TextBox:
<asp:Repeater runat="server" OnItemDataBound="Repeater_OnItemDataBound" ID="MyRepeater">
<ItemTemplate>
<div class="row">
<asp:Label ID="Name" Text="<%# Eval("name") %>" runat="server" AssociatedControlID="Id" />
<asp:TextBox ID="Value" runat="server" Text="<%# Eval("value") %>" Visible="False" />
<asp:TextBox ID="Id" runat="server" />
</div>
</ItemTemplate>
</asp:Repeater>
But this does not seems to work. I'm getting a The server tag is not well formed error.
How can I use the binded values in my label and textbox?
Upvotes: 1
Views: 544
Reputation: 17680
You have implemented the quotes " wrongly.
See below.
<asp:Label ID="Name" Text='<%# Eval("name") %>' runat="server" AssociatedControlID="Id" />
<asp:TextBox ID="Value" runat="server" Text='<%# Eval("value") %>' Visible="False" />
Upvotes: 2