C#
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
ViewState["OrigData"] = e.Row.Cells[0].Text;
if (e.Row.Cells[0].Text.Length >= 30) //Just change the value of 30 based on your requirements
{
e.Row.Cells[0].Text = e.Row.Cells[0].Text.Substring(0, 30) + "...";
e.Row.Cells[0].ToolTip = ViewState["OrigData"].ToString();
}
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
ViewState["OrigData"] = e.Row.Cells[0].Text;
if (e.Row.Cells[0].Text.Length >= 30) //Just change the value of 30 based on your requirements
{
e.Row.Cells[0].Text = e.Row.Cells[0].Text.Substring(0, 30) + "...";
e.Row.Cells[0].ToolTip = ViewState["OrigData"].ToString();
}
}
}
VB.NET
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
ViewState("OrigData") = e.Row.Cells(0).Text
If e.Row.Cells(0).Text.Length >= 30 Then 'Just change the value of 30 based on your requirements
e.Row.Cells(0).Text = e.Row.Cells(0).Text.Substring(0, 30) + "..."
e.Row.Cells(0).ToolTip = ViewState("OrigData").ToString()
End If
End If
End Sub
If e.Row.RowType = DataControlRowType.DataRow Then
ViewState("OrigData") = e.Row.Cells(0).Text
If e.Row.Cells(0).Text.Length >= 30 Then 'Just change the value of 30 based on your requirements
e.Row.Cells(0).Text = e.Row.Cells(0).Text.Substring(0, 30) + "..."
e.Row.Cells(0).ToolTip = ViewState("OrigData").ToString()
End If
End If
End Sub
Have a nice day... 'N happy Coding :)
No comments:
Post a Comment