Tuesday, January 30, 2007

Datagrid - ItemTemplate, ToolTip

Problem:
Display a short description or abbreviation in a DataGrid column.

The short description or abbreviation by itself may not be general knowledge. Add the feature of allowing the user to hover over the value and receive a balloon help. The balloon help is a longer description of the abbreviation.



Solution:


<asp:TemplateColumn HeaderText="DataGridHeaderText">
<ItemTemplate>

<acronym title='<%# DataBinder.Eval(Container.DataItem, "FieldNameLongDescription") %> '>
<%# DataBinder.Eval(Container.DataItem, "FieldName") %>
</acronym>

</ItemTemplate>
</asp:TemplateColumn>

No comments: