how to set ondemnad tooltip on one of the resource header

10 posts, 0 answers
  1. Prava kafle
    Prava kafle avatar
    212 posts
    Member since:
    Apr 2010

    Posted 15 Jul 2014 Link to this post

    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
  2. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 18 Jul 2014 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Prava kafle
    Prava kafle avatar
    212 posts
    Member since:
    Apr 2010

    Posted 24 Jul 2014 in reply to Plamen Link to this post

    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
  5. Prava kafle
    Prava kafle avatar
    212 posts
    Member since:
    Apr 2010

    Posted 24 Jul 2014 in reply to Plamen Link to this post

    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
  6. Prava kafle
    Prava kafle avatar
    212 posts
    Member since:
    Apr 2010

    Posted 24 Jul 2014 in reply to Plamen Link to this post

    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
  7. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 28 Jul 2014 Link to this post

    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.

     
  8. Prava kafle
    Prava kafle avatar
    212 posts
    Member since:
    Apr 2010

    Posted 28 Jul 2014 in reply to Plamen Link to this post

    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
  9. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 31 Jul 2014 Link to this post

    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.

     
  10. Prava kafle
    Prava kafle avatar
    212 posts
    Member since:
    Apr 2010

    Posted 31 Jul 2014 in reply to Plamen Link to this post

    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>
  11. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 04 Aug 2014 Link to this post

    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.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017