代码隐藏中DIV的语法错误

Syntax error for DIV in code behind

本文关键字:语法 错误 DIV 隐藏 代码      更新时间:2023-09-26

我正试图实现以下内容:

eventListingPanel.Controls.Add(new LiteralControl("<div style="overflow :auto; width:200px;  height:200px">"));

但是我得到了一个错误:

")预期"

带有红色下划线的关键字溢出,auto,200px,200px在上面的代码

试试这个:

eventListingPanel.Controls.Add(new LiteralControl("<div style='"overflow :auto; width:200px;  height:200px'"></div>"));

您没有逃离"

eventListingPanel.Controls.Add(new LiteralControl("<div style='"overflow :auto; width:200px;  height:200px'">"));