This is a migrated thread and some comments may be shown as answers.

RadToolTip in RadRotator in Dymanic User Control

0 Answers 29 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Gregory
Top achievements
Rank 2
Gregory asked on 29 Aug 2011, 03:12 PM
Hello.  This problem was driving me crazy and I wasn't able to find a result in the forum, so I thought I'd share my resolution. 

We had an ASP GridView that was being databound to a collection of heterogeneous objects.  In the GridView DataBound event, we were calling a Factory to instantiate a dynamically selected User Control that corresponded to the object.  So Object A would get a ObjectAUI.ascx control, etc. 

One of the controls received an Album object.  This Album object contained a collection of images.  We implemented the RadRotator control as a filmstrip and databound the collection of images to it.  This worked fine for all accesses to the page, both !IsPostBack and IsPostBack.

Each of the RadRotator items contained a RadToolTip item.  This seemed to work fine for all !IsPostBack scenarios but was an empty shell (only static content) on any IsPostBack, async or otherwise.  An example would be a change in the DataGrid objects.  What we needed was the RadToolTip to be filled in with databound content whether it was the first visit to the page or part of an async PostBack.

My solution was to wrap the loading of the RadToolTip content into a LoadContent() method, which the Page_Load method called.  This worked fine for !IsPostBack scenarios.  I then created a public Notify() method that also called this LoadContent() method.  In my RadRotator_ItemDataBound method, I have the following:

protected void thumbRotator_ItemDataBound(object sender, RadRotatorEventArgs e)
{
  ImageToolTip ctlImageToolTip = e.Item.FindControl("ctlImageToolTip") as ImageToolTip;
  ...
  if (IsPostBack)
  {
    ctlImageToolTip.Notify();
  }
}

Now the RadToolTip updates correctly when either the page is visited the first time (!IsPostBack) or the DataGrid objects are changed (async IsPostBack).

No answers yet. Maybe you can help?

Tags
ToolTip
Asked by
Gregory
Top achievements
Rank 2
Share this question
or