Search code examples
.netasp.netservercontrols

Response.Write not working inside server control property?


I am not sure why this is not working.

<asp:Label ID="lblTitle1" runat="server" Text='<%= string.Format("{0} <br /> {1}","Part 1", "Part 2") %>' ></asp:Label>

I just want to combine two resource string as text of label?


Solution

  • Use databinding instead, Text='<%# String.Format(...) %>' and make sure you call DataBind() somewhere in your code.