0

I have this label that get's its text from code behind. Due to the complexity of the code behind but mostly - not suppose to change any code behind - need to modify the label text on the front-end so it will look like currency.

Here is a label so far that sits inside the update panel:

<asp:Label ID="txtRFee" name="txtRFee" runat="server"></asp:Label>

This is what I added to the label:

<asp:Label ID="txtRFee" name="txtRFee" runat="server" Text="<%# Eval("txtRFee", "{0:c}") %>"></asp:Label>

It always comes out blank. Since it is sitting inside the asp:UpdatePanel inside the Eval when giving it ID need to specify that it sits inside the UpdatePanel but I tried pretty much everything. it will not compile. Tried txtRFee.ClientID etc

Text on the label comes out but Eval is being ignored. Any help is appreciated!

1 Answers1

0

It looks like quotes are your problem. Change the outer quotes aroung the Text attribute to single quotes, like this:

<asp:Label ID="txtRFee" name="txtRFee" runat="server" Text='<%# Eval("txtRFee", "{0:c}") %>'></asp:Label>

There's a comment on this question that address the need for single quotes around an Eval() that uses double quotes. Good luck.

Community
  • 1
  • 1
John Riehl
  • 1,270
  • 1
  • 11
  • 22