I am displaying some large text in a System.Web.UI.WebControls.Gridview
control (integrated in an ASP.NET web page) and I ended up showing the whole text only in a tooltip:
if (e.Row.RowType == DataControlRowType.DataRow)
{
string bigText = e.Row.Cells[5].Text;
if (e.Row.Cells[5].Text.Length >= 100)
{
e.Row.Cells[5].Text = e.Row.Cells[5].Text.Substring(0, 100) + "...";
e.Row.Cells[5].ToolTip = bigText;
}
}
(don't mind the code, it's just an example of what I did)
The thing is that I would want users to be able to copy all the text and use it eventually. Even more, the tooltip does not really show all the text if it's huge so being able to copy all the text would be of great help.
Can I do this from the tooltip? Or do I have to implement something else?
The functionality I want is somewhat similar with copying error texts from the datatip in the Visual Studio debugger (althought I would live skipping the Copy Value part).