Author: xr280xr | Posted on: 10/12/2009 11:19:03 AM | Views : 307

Hi,
This is probably a dumb question but I'm not seeing what's happening at the moment. I have a datalist with a label control in the item template. For some reason the label was leaving blanks where I was expecting to see bound values. It turns out that the databinding expression only works when it's not embedded within literal text. For example:
<asp:Label ID="Label1" runat="server" Text='<%# GetDepositDue(Container.DataItem) %>' /> <asp:Label ID="Label1" runat="server" Text='Deposit: <%# GetDepositDue(Container.DataItem) %>' /> The first line will bind, but the second line won't because there is literal text + the databinding expression. Why won't the second line work? The following does work:
<asp:Label ID="Label1" runat="server">Deposit: <%# Ge ...

Go to the complete details ...