我想设置MVC网格列文本长度。
就像例子一样。如果文字是:
" Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam consectetur venenatis blandit. Praesent vehicula, libero non pretium vulputate, lacus arcu facilisis lectus, sed feugiat tellus nulla eu dolor. Nulla porta bibendum lectus quis euismod. Aliquam volutpat ultricies porttitor. Cras risus nisi, accumsan vel cursus ut, sollicitudin vitae dolor. Fusce scelerisque eleifend lectus in bibendum. Suspendisse lacinia egestas felis a volutpat. "
然后Grid Column显示如下:“ Lorem ipsum dolor sit amet ... ”
我用Substring尝试了它,但它给出了错误。 像这样
grid.Column(“TicketDescription”.Substring(0,30)+'....',标题:“描述”,样式:“charlength”)
对此有任何建议 帮助我。
答案 0 :(得分:3)
你应该使用'text-overflow:ellipsis;' css造型:
将下一个样式添加到您的单元格
<ul id="sidebar-lists">
<span id="emp-dep-lists">
{{#each associateList}}
<li>
<a href="#">
{{#if image}}
<img src="{{image}}" height="35" width="35">
{{else}}
<img height="35" width="35" src="/assets/images/black-user-shape.svg">
{{/if}}
<span class="title">{{name}}</span>
</a>
</li>
{{/each}}
</span>
<li>
<a href="#">
<img height="35" width="35" src="http://localhost:8084/assets/empImg/spot_1241.jpeg">
<span class="title">John</span>
</a>
</li>
</ul>