We are creating a Grid dynamically based upon an ad-hoc definition of selected columns and data sources by the end-user. We have a number of columns which we need to offer the user "ToolTip" information which is database driven and specific to the value in the row.
I've been looking at building a new class which implements ITemplate and adds the field value (using a label) and attaches a RadToolTip to the label in the cell, but it seems like I have to implement the formatting/aggregates/etc on my own.
Another thought I had would be to use an BoundColumn, but override the DataBinding event (or to add an additional event to the firing of DataBind) and attach the tooltip there, but it seems like I can't. We have source code access and I can see how it's done behind the scenes, but I'm just not sure where to do it and still use the released controls.
Right now our columns inherit from the base GridColumns (GridBoundColumn, GridHyperlinkColumn) and get their values on the fly from from our settings system. Here's an example:
public class BoundGridColumn : Telerik.Web.UI.GridBoundColumn |
{ |
public BoundGridColumn() |
{ |
} |
public BoundGridColumn(string column) |
{ |
this.DataField = column; |
this.UniqueName = column; |
this.SortExpression = column; |
this.HeaderText = Utility.GetSetting(column + ".Header"); |
if (Utility.GetSetting(column + ".Width").Length > 0) |
{ |
int _width = Convert.ToInt32(Utility.GetSetting(column + ".Width")); |
this.HeaderStyle.Width = Unit.Pixel(_width); |
this.FooterStyle.Width = Unit.Pixel(_width); |
this.ItemStyle.Width = Unit.Pixel(_width); |
} |
else |
{ |
this.HeaderStyle.Width = Unit.Pixel(100); |
this.FooterStyle.Width = Unit.Pixel(100); |
this.ItemStyle.Width = Unit.Pixel(100); |
} |
if (Utility.GetSetting(column + ".Item.Align").Length > 0) |
this.ItemStyle.HorizontalAlign = (HorizontalAlign)Enum.Parse(typeof(HorizontalAlign) , (Utility.GetSetting(column + ".Item.Align"))); |
if (Utility.GetSetting(column + ".Footer.Align").Length > 0) |
this.FooterStyle.HorizontalAlign = (HorizontalAlign)Enum.Parse(typeof(HorizontalAlign) , (Utility.GetSetting(column + ".Footer.Align"))); |
if (Utility.GetSetting(column + ".Header.Align").Length > 0) |
this.HeaderStyle.HorizontalAlign = (HorizontalAlign)Enum.Parse(typeof(HorizontalAlign) , (Utility.GetSetting(column + ".Header.Align"))); |
// = Unit.Pixel(_width); |
if (Utility.GetSetting(column + ".Visible").Length > 0) |
this.Visible = Convert.ToBoolean(Utility.GetSetting(column + ".Visible")); |
this.DataFormatString = Utility.GetSetting(column + ".Format"); |
this.DataType = System.Type.GetType(Utility.GetSetting(column + ".DataType")); |
if (Utility.GetSetting(column + ".Aggregate").Length > 0) |
this.Aggregate = (GridAggregateFunction)Enum.Parse(typeof(GridAggregateFunction) , Utility.GetSetting(column + ".Aggregate")); |
if (Utility.GetSetting(column + ".AllowFiltering").Length > 0) |
this.AllowFiltering = Convert.ToBoolean(Utility.GetSetting(column + ".AllowFiltering")); |
this.Groupable = true; |
this.ItemStyle.Wrap = false; |
} |
So where/how can I attach a value specific tooltip to this column