在VS2005中,如何在把每列的宽度固定下之后,让GridView不换行,即只显示部分数据。
解决方案 »
- freetextbox相对路径设置
- 新手!怎么样在单元格中设置超过规定字数后显示...省略号!
- 注释显示问题
- 没个人都会遇到的最常见的问题,关于TreeView做权限编辑的时候,数据库中的Value字段有节点的TEXT值时该节点的CHECKBOX就勾选,否则不勾选
- vs03与vs05在使用webconfig中数据库连接的区别
- 谁有 月历,精确到月的,不要日的。最好用js写的控件
- 导致该错误的原因可能是在 IIS 中没有将虚拟目录作为应用程序进行配置
- <td>里自动换行的问题
- 加入qq群!
- 能否在JavaScript中调用VB函数啊??
- 有用asp.net做视频聊天的么?
- 怎么得到点击进入另一个页面的那个页面的地址啊?(在线等,急)
{
if (e.Row.RowType==DataControlRowType.DataRow)
{
if (e.Row.Cells[1].Text.Length>10)
{
e.Row.Cells[1].Text = e.Row.Cells[1].Text.Substring(0, 10) + "...";
}
}
}
贴点代码供参考:
protected void gdvLog_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)//判定当前的行是否属于datarow类型的行
{
Label lblUserAgent = (Label)e.Row.FindControl("lblUserAgent");
lblUserAgent.Text = lblUserAgent.ToolTip.Substring(0, 45);
在ASPX页面中模板列加入这个lbluserAgent控件
<ItemTemplate>
<asp:Label ID="lblUserAgent" runat="server" EnableViewState="False" ToolTip='<%# Eval("userInfo") %>'></asp:Label>
</ItemTemplate>
private void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType!=DataControlRowType.DataRow)
{
if (e.Row.Cells[1].Text.Length>10)
{
e.Row.Cells[1].Text = e.Row.Cells[1].Text.Substring(0, 10) + "";
}
}
}