RowDataBound event of GridView
protected void myGridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
for (int i = 0; i < e.Row.Cells.Count; i++)
{
if (e.Row.Cells[i].Controls.Count == 0)
{
e.Row.Cells[i].ToolTip = e.Row.Cells[i].Text;
}
else
{
e.Row.Cells[i].ToolTip = GetObjectType(e.Row.Cells[i].Controls[1]);
}
}
}
}
private String GetObjectType(Control ctrl)
{
switch (ctrl.GetType().Name)
{
case "Label":
return ((Label)ctrl).Text;
case "TextBox":
return ((TextBox)ctrl).Text;
}
return "";
}
Regards,
Senthil