简体   繁体   中英

How to use class in div tag inside asp.net controls 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.

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>"

If you really need to use quotation marks, you need to use escape characters for them:

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

See this MSDN: https://msdn.microsoft.com/en-us/library/h21280bw.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM