I tried that, but the tooltip doesn't show for an asp:Label, apparently.
Tom
That's strange.. The following code works for me:
Codebehind:
---------------
namespace localhost
{
public class ToolTipTest : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid DataGrid1;
private void Page_Load(object sender, System.EventArgs e)
{
SomeDataItem item1 = new SomeDataItem("Text 1", "ToolTip 1");
SomeDataItem item2 = new SomeDataItem("Text 2", "ToolTip 2");
SomeDataItem item3 = new SomeDataItem("Text 3", "ToolTip 3");
SomeDataItem[] items = new SomeDataItem[] {item1, item2, item3};
DataGrid1.DataSource = items;
DataGrid1.DataBind();
}
#region Web Form Designer generated code
// ...
#endregion
}
public class SomeDataItem
{
private string text;
private string toolTip;
public string Text
{
get
{
return text;
}
set
{
text = value;
}
}
public string ToolTip
{
get
{
return toolTip;
}
set
{
toolTip = value;
}
}
public SomeDataItem(string text, string toolTip)
{
Text = text;
ToolTip = toolTip;
}
}
}
-------------------
Web page:
-------------------
<asp
ataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 120px; POSITION:
absolute; TOP: 128px"
runat="server" AutoGenerateColumns="False" Width="184px">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Label id=Label1 runat="server" ToolTip='<%#
DataBinder.Eval(Container.DataItem, "ToolTip") %>' Text='<%#
DataBinder.Eval(Container.DataItem, "Text") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp
ataGrid>
-----------------
Generated HTML output:
-----------------
<table cellspacing="0" rules="all" border="1" id="DataGrid1"
style="width:184px;border-collapse:collapse;Z-INDEX: 101; LEFT: 120px;
POSITION: absolute; TOP: 128px">
<tr>
<td> </td>
</tr><tr>
<td>
<span id="DataGrid1__ctl2_Label1" title="ToolTip 1">Text 1</span>
</td>
</tr><tr>
<td>
<span id="DataGrid1__ctl3_Label1" title="ToolTip 2">Text 2</span>
</td>
</tr><tr>
<td>
<span id="DataGrid1__ctl4_Label1" title="ToolTip 3">Text 3</span>
</td>
</tr>
</table>
---------
The title attribute of a <span> displays a tooltip, at least in IE 6.0
HTH,
Lars-Erik