我从后面的代码动态生成分页,但我的 html 设计不同。如何将类添加到列表项。代码如下
if (pageCount > 0)
{
pages.Add(new ListItem("First", "1", currentPage > 1));
for (int i = 1; i <= pageCount; i++)
{
pages.Add(new ListItem(i.ToString(), i.ToString(), i != currentPage));
}
pages.Add(new ListItem("Last", recordCount.ToString(), currentPage < pageCount));
}
同样的HTML是
<ul class="pages-pagina">
<li class="pages previous"><a href="#">Previous</a></li>
<li class="pages selected"><a href="#">1</a></li>
<li class="pages"><a href="#">2</a></li>
<li class="pages"><a href="#">3</a></li>
<li class="pages"><a href="#">4</a></li>
<li class="pages"><a href="#">5</a></li>
<li>...</li>
<li class="pages last"><a href="#">10</a></li>
<li class="pages next"><a href="#">Next</a></li>
</ul>
谢谢,