目前我使用的是这样的...如何使用Read More链接限制GridView中的标签字符串长度?
<asp:TemplateField HeaderText="Description">
<ItemTemplate>
<asp:Label ID="lblDescription" runat="server"
Text='<%# Limit(Eval("Description"),40) %>' >
</asp:Label>
</ItemTemplate>
的辅助函数:
public static string Limit(object Desc, int length)
{
StringBuilder strDesc = new StringBuilder();
strDesc.Insert(0, Desc.ToString());
if (strDesc.Length > length)
return strDesc.ToString().Substring(0, length) + "..." + [Read More];
else return strDesc.ToString();
}
但我不知道如何把[阅读全文]链接...
我想为你的答案投票...但没有足够的声望。 :( 现在这一个是阅读更多,仪式?如何隐藏。谢谢 – CMMaung 2011-05-16 05:56:42
现在可以投票:) – CMMaung 2011-05-16 05:59:37
升级代码。希望这可以帮助。 – naveen 2011-05-16 06:04:05