gkrishy gkrishy - 1 year ago 72
C# Question

How to use class in div tag inside innerhtml c#

I'm trying to use div tag inside innerhtml c#. Below is my piece of code for sample,

slideUL.InnerHtml = "<div class = "slide - holder"/>"

But I'm getting compile error. Please any one guide me to proceed this.

Answer Source

You can use single quote or escape with double quote for class property. I think class name should be without any space like slide-holder. Also you have missed close </div> tag

slideUL.InnerHtml = "<div class = \"slide-holder\"/></div>"