I have a page that has a RadComboBox and a RadGrid that displays plans and is grouped by the plan type. Specs call for the user to be able to filter which type and only that type to see. I am using the RadComboBox to be able to select which type to filter by, which post back and updates the grid accordingly. I am also using a RadAjaxManagerProxy to do the updating with the ComboBox and Grid in the settings.
The issue is that I am using a RadTooltipManager to tooltipifiy the details in the Grid Rows and works perfectly on the initial render. But when I select a new item from the ComboBox and the Grid begins to update there is a Null Reference exception being thrown because it says it can not find the control with the id that is being added to the RadTooltipManager's TargetControl collection.
I have commented out the two lines where the add to the TargetControl collection takes place and everything works fine. And the reason why I'm needing to add to the TargetControl collection is because there are some buttons that do not need to be tooltipified. One question I'm wondering about is do I need to update the TooltipManager when a postback occurs? I'll attach a code segment below that will show how I have the TargetControl.Add().
Thank you for any advice on this matter.
The issue is that I am using a RadTooltipManager to tooltipifiy the details in the Grid Rows and works perfectly on the initial render. But when I select a new item from the ComboBox and the Grid begins to update there is a Null Reference exception being thrown because it says it can not find the control with the id that is being added to the RadTooltipManager's TargetControl collection.
I have commented out the two lines where the add to the TargetControl collection takes place and everything works fine. And the reason why I'm needing to add to the TargetControl collection is because there are some buttons that do not need to be tooltipified. One question I'm wondering about is do I need to update the TooltipManager when a postback occurs? I'll attach a code segment below that will show how I have the TargetControl.Add().
Thank you for any advice on this matter.
protected void gridAllPlans_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem) |
{ |
var targetPlanYearName = e.Item.FindControl("planYearName"); |
var targetPlanName = e.Item.FindControl("planName"); |
if (!Equals(targetPlanYearName, null)) |
{ |
if (!Equals(this.radToolTipManager, null)) |
{ |
var year = (PlanPlanYearInfo)e.Item.DataItem; |
if (year.PlanPlanYear != null) |
((WebControl)targetPlanYearName).Attributes["OnMouseOver"] = String.Format("DisplayPlanYearName('{0}', '{1}');", targetPlanYearName.ClientID, year.PlanPlanYear.PlanYearId); |
((WebControl)targetPlanName).Attributes["OnMouseOver"] = String.Format("DisplayPlanName('{0}', '{1}');", targetPlanName.ClientID, year.Plan.Id); |
radToolTipManager.TargetControls.Add(targetPlanName.ID); |
radToolTipManager.TargetControls.Add(targetPlanYearName.ID); |
} |
} |
} |
} |