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

how to set ondemnad tooltip on one of the resource header

9 Answers 92 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Prava kafle
Top achievements
Rank 1
Prava kafle asked on 15 Jul 2014, 02:50 PM
Hi,

I am trying to show a tool tip on resource header just like the one on appointment. I am grouping my scheduler by TechNames and would like to show  some information when a user hovers over a  technician. I have multiple resources in scheduler(TechName, TicketStaet,...).Following code executes multiple times and slows my application. Is there a way to know if a tooltip is already assigned to a tech?
 protected void rsTicketsSchedule_ResourceHeaderCreated(object sender, ResourceHeaderCreatedEventArgs e)
    {
        ((Label)e.Container.FindControl("ResourceLabel")).Text = e.Container.Resource.Text;
        
        if (e.Container.Resource.Type == "TechName")
        {
            //need to avoid duplicate items in the list
            //Register control for tooltip:
        ToolTipTargetControl tooltipTargetControl = new ToolTipTargetControl(e.Container.FindControl("ResourceLabel").ClientID, true);
        if(RadToolTipManagerUserName.TargetControls.Contains(tooltipTargetControl)  == false)
            RadToolTipManagerUserName.TargetControls.Add(e.Container.FindControl("ResourceLabel").ClientID, true);
       }
    }

}
 
Any idea?

Regards,
Prava

9 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 18 Jul 2014, 10:00 AM
Hi Prava,

I have inspected the scenario and the case described and it seems like all the labels are added only one time correctly in the tooltip manager collection. The resource created event is thrown one time for every resource and the client IDs of the labels are different for every resource- that is why each one of them is added correctly to the tooltip collection.

Hope this will explain the issue. Please let me know if you have further questions

Regards,
Plamen
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Prava kafle
Top achievements
Rank 1
answered on 24 Jul 2014, 11:02 PM
Hi Plamen,

I do agree each tooltiptargetcontrol has different cleintID.I only have one technician in my schedulertimeline view which has 21 timeslots and I want tooltiptarget control to be set only once for this tech. Is there a way to do that? Eventhough, I have only one tech in my scheduler, above code sets around 200 tooltip target control in resource header.

Thanks,
Prava
0
Prava kafle
Top achievements
Rank 1
answered on 24 Jul 2014, 11:06 PM
Hi Plamen,

I do agree each tooltiptargetcontrol has unique clientID. My scheduler in timeline view has only one tech and 21 timeslots and I want to set only one tooltiptarget control for this single tech. When I hover over techname in scheduler, it should load tooltip on demand.
Right now, moving anywhere in scheduler sends request for tooltip and it is slowing the application.

I would like to set tooltip target control only once for this single tech. Is there a way to do that?

Thanks,
Prava
0
Prava kafle
Top achievements
Rank 1
answered on 24 Jul 2014, 11:06 PM
Hi Plamen,

I do agree each tooltiptargetcontrol has unique
clientID. My scheduler in timeline view has only one tech and 21
timeslots and I want to set only one tooltiptarget control for this
single tech. When I hover over techname in scheduler, it should load
tooltip on demand.
Right now, moving anywhere in scheduler sends request for tooltip and it is slowing the application.

I would like to set tooltip target control only once for this single tech. Is there a way to do that?

Thanks,
Prava
0
Plamen
Telerik team
answered on 28 Jul 2014, 11:50 AM
Hello Prava,

I have inspected the scenario at my side once again but unfortunately could no find out what is not working correctly. I have isolated the issue into a sample project and attached it here. Would you please review it and let elaborate what is not working correctly and how would you like it to work so we could inspect it once again and b e more helpful?

Regards,
Plamen
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Prava kafle
Top achievements
Rank 1
answered on 28 Jul 2014, 01:23 PM
Hi Plamen,
Thanking you for taking time to create this sample application. Any view in given sample, tooltiptargetcontrol  is attached 7 times even though we have only three user "alex", "Bob" and "Charlie". I would like to attach tootltiptarget control only once for each user.

Thanks,
Prava
0
Plamen
Telerik team
answered on 31 Jul 2014, 08:45 AM
Hello Prava,

I have inspected the scenario and it attached 3 times at my side- once for every tool tip. Here is a video of my test where I have added the text of each resource once it is populated. 

Please review it and let me know what else should be done in order to replicate the unusual behavior.

Regards,
Plamen
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Prava kafle
Top achievements
Rank 1
answered on 31 Jul 2014, 02:10 PM
Hi plamen,


On initialpage load it loops only three times. Then on every post back it loops six times. I have attached
Here is my code with global variable "  int counter = 0;  "


C#:
...............................
  int counter = 0;  
    protected void RadScheduler1_ResourceHeaderCreated(object sender, ResourceHeaderCreatedEventArgs e)
    {
        
        ((Label)e.Container.FindControl("ResourceLabel")).Text = e.Container.Resource.Text;

        if (e.Container.Resource.Type == "User")
        {
            //need to avoid duplicate items in the list
            //Register control for tooltip:
            ToolTipTargetControl tooltipTargetControl = new ToolTipTargetControl(e.Container.FindControl("ResourceLabel").ClientID, true);
            if (RadToolTipManagerUserName.TargetControls.Contains(tooltipTargetControl) == false)
            {
                RadToolTipManagerUserName.TargetControls.Add(e.Container.FindControl("ResourceLabel").ClientID, true);
                counter = counter+ 1 ;
            }
        }

        TooTipCounter.Text = "TotalToolTips =" + counter;
    }



HTML:
..................
   <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
        </Scripts>
    </telerik:RadScriptManager>
    <telerik:RadScheduler runat="server" ID="RadScheduler1" GroupBy="User" OnResourceHeaderCreated="RadScheduler1_ResourceHeaderCreated">   
          <ResourceHeaderTemplate>
              <asp:Label runat="server" ID="ResourceLabel"></asp:Label>
            </ResourceHeaderTemplate>       
    </telerik:RadScheduler>
        <telerik:RadToolTipManager runat="server" ID="RadToolTipManagerUserName"></telerik:RadToolTipManager>
        <asp:Label ID="TooTipCounter" Text="TotalToolTips =0" runat="server"></asp:Label>
    </form>
0
Plamen
Telerik team
answered on 04 Aug 2014, 11:34 AM
Hi Prava,

Thank you for elaborating the issue. Yes indeed - this is how the ResourceHeaderCreated event is working by default. If you want to add your tooltip one ones you can check if the event is actually thrown after the Page_load event as in the code below:
bool navigate = false;
  protected void Page_Load(object sender, EventArgs e)
  {
      navigate = true;
  }
  int counter = 0;
  protected void RadScheduler1_ResourceHeaderCreated(object sender, ResourceHeaderCreatedEventArgs e)
  {
 
      ((Label)e.Container.FindControl("ResourceLabel")).Text = e.Container.Resource.Text;
      
      if (e.Container.Resource.Type == "User" && navigate)

Hope this will explain the issue. 

Regards,
Plamen
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Scheduler
Asked by
Prava kafle
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Prava kafle
Top achievements
Rank 1
Share this question
or