c# - "Substring"GridView BoundField 对象

标签 c# asp.net visual-studio-2008

谁能告诉我如何对 GridView BoundField 对象进行子字符串化吗?

到目前为止我已经尝试过了,但还没有成功。谢谢。

<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# ChopString((string)Eval("description")) %>'></asp:Label>
</ItemTemplate>

最佳答案

您需要使用子字符串。

   Eval("description").ToString().Substring(0,60)

我相信这就是您所需要的。

关于c# - "Substring"GridView BoundField 对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11088633/

相关文章:

c++ - 如何禁用 Boost 概念检查

javascript - 出现时将对象传递给模态

c# - 从集合中移除对象

c++ - Visual Studio 输出窗口错误 - C++

c# - 使用 Asp.net mvc 或 web 服务会更好吗?

asp.net - 使用 Firefox 时如何在 visual studio 2008 中启用脚本调试

visual-studio - Visual Studio Express 的源版本控制

c# - 使用隐藏代码设置 div 的 css 类

c# - 如何限制文件夹/文件只能访问一个程序?

c# - 不同域的登录页面