如何实现:GridView 控件中显示的文本不自动换行,隐藏超出宽度部分wj-wangjun
如何实现:GridView 控件中显示的文本不自动换行,隐藏超出宽度部分
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="linkbNewsTitle" runat="server" Text='<%# Bind("ch_Remark") %>' ToolTip='<%# Bind("ch_Remark") %>'>
</asp:LinkButton>
</ItemTemplate>
<ItemStyle Width="300" />
</asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="linkbNewsTitle" runat="server" Text='<%# Bind("ch_Remark") %>' ToolTip='<%# Bind("ch_Remark") %>'>
</asp:LinkButton>
</ItemTemplate>
<ItemStyle Width="300" />
</asp:TemplateField>
protected void gvNewsManage_RowDataBound(object sender, GridViewRowEventArgs e)
{
if ((LinkButton)e.Row.FindControl("linkbNewsTitle") != null)
{
LinkButton linkbTitle = (LinkButton)e.Row.FindControl("linkbNewsTitle");
if (linkbTitle.Text.Length > 10)
{
linkbTitle.Text = linkbTitle.Text.Substring(0, 9) + "";
}
Label lblinknewID = (Label)e.Row.FindControl("ltgvnid");
// linkbTitle.PostBackUrl = "EditNewsContent.aspx?ID=" + lblinknewID.Text;
}
}
//==========================================
protected void gvNewsManage_RowDataBound(object sender, GridViewRowEventArgs e)
{
string strValue = e.Row.Cells[18].Text.ToString();
if (strValue != null)
{
if (strValue.Length > 9)
{
e.Row.Cells[18].Text = strValue.Substring(0, 9) + "";
}
}
}
{
if ((LinkButton)e.Row.FindControl("linkbNewsTitle") != null)
{
LinkButton linkbTitle = (LinkButton)e.Row.FindControl("linkbNewsTitle");
if (linkbTitle.Text.Length > 10)
{
linkbTitle.Text = linkbTitle.Text.Substring(0, 9) + "";
}
Label lblinknewID = (Label)e.Row.FindControl("ltgvnid");
// linkbTitle.PostBackUrl = "EditNewsContent.aspx?ID=" + lblinknewID.Text;
}
}
//==========================================
protected void gvNewsManage_RowDataBound(object sender, GridViewRowEventArgs e)
{
string strValue = e.Row.Cells[18].Text.ToString();
if (strValue != null)
{
if (strValue.Length > 9)
{
e.Row.Cells[18].Text = strValue.Substring(0, 9) + "";
}
}
}