Hello all,
I'm trying to change the innerHtml of a div in the code behind and noticed an interesting thing. If I have this situation:
aspx file:
<div id="displayPanel" runat="server">
</div>
C#
while(reader.Read()){
...
displayPanel.InnerHtml += "<span>"+ name + " has donated £ " + donation + "</span>";
}
everything goes as planned (the div is populated with how many rows are in the SQL table and the data is wrapped in a span as I wanted). But if the displayPanel div has a .net control in it as in
<div id="displayPanel" runat="server">
<asp:Label ID="label1" runat="server" Text="label" />
</div>
with the same code behind, I get an error saying "Cannot get inner content of divID because the contents are not literal". Why is that? I'm not trying to get the innerHtml of the controller - which understandably could lead to a compiling error, but I'm trying to get the innerHtml of the div!
thanks