I have a div in the aspx page which i gave the attribute runat = "server" and id = "content". When starting the page I need to create some cards with data taken from a database. But it gives me error when I try from code behind in c # using content.InnerHtml to add html code.
aspx page
<div >
<div runat="server" id="contenuto">
</div>
</div>
code behind
contenuto.InnerHtml = "<div class='row'>";
it gives me this error: "Could not get the internal content of content because it is not in literal format."
CodePudding user response:
I try to use what sandeepjersey10061990 suggested me but it gaves me this error error .
Someone could help me, pls?
CodePudding user response:
"contenuto" not containing any server control inside it, you required to change your code like below -
var sb = new StringBuilder();
String innertext =sb.Append("Text what you required or tag");
contenuto.InnerHtml = innertext ;