0

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 class="page-wrapper">
            <div class="page-content" 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."

image of the Error

Giammy
  • 1
  • 1

1 Answers1

-1

"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 ;
phuzi
  • 12,078
  • 3
  • 26
  • 50