如何从代码隐藏中删除Html <li>项目符号?

anm*_*rti 1 javascript css code-behind html-lists

我从codebehind创建一个html列表,如下所示:

HtmlGenericControl list = new HtmlGenericControl("ul");
for (int i = 0; i < 10; i++)
{
   HtmlGenericControl listItem = new HtmlGenericControl("li");
   Label textLabel = new Label();
   textLabel.Text = "Menu"+i;
   listItem.Controls.Add(textLabel);
   list.Controls.Add(listItem);
}
Run Code Online (Sandbox Code Playgroud)

但渲染列表有子弹,我想阻止它们.

Nea*_*eal 20

使用CSS:

ul {
   list-style: none;
}
Run Code Online (Sandbox Code Playgroud)


Sea*_*ing 6

我想你可以使用style属性:

list.Style.Add("list-style", "none");
Run Code Online (Sandbox Code Playgroud)