Dynamic Width

7 posts, 0 answers
  1. Eva Stephen
    Eva Stephen avatar
    14 posts
    Member since:
    Dec 2009

    Posted 18 Dec 2009 Link to this post

    Hi ,

    I need to set dynamic width for my tool tip. If the tool tip is too long it has to go next line.

     

    Also i noticed in this http://demos.telerik.com/aspnet-ajax/tooltip/examples/bindtotarget/defaultcs.aspx

    for single line tooltip the skin looks weird(see the attachment) , for multiple line tool tip the skin looks ok. Most of my tooltip has single line it looks not too good .Do you have any workaround?

    Thanks.
    Eva

  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 19 Dec 2009 Link to this post

    Hi Eva ,

    What I can suggest is to set Width to the tooltip manager such as needed for the smallest content and do not set any ContentScrolling setting but leave the default one. This should force the tooltip to resize to bigger width when needed and stay with an appropriate one when not needed to enlarge.

    Another possiblity is to capture the OnClientShow or OnClientBeforeShow event and set dynamically the desired width there.


    Greetings,
    Svetlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Eva Stephen
    Eva Stephen avatar
    14 posts
    Member since:
    Dec 2009

    Posted 21 Dec 2009 Link to this post

    I tried to change the width , it didn't work . Also the tooltip was loosing its border style(see the attachment).

    I noticed in this http://demos.telerik.com/aspnet-ajax/tooltip/examples/bindtotarget/defaultcs.aspx

    for single line tooltip the skin looks weird(see the attachment from original post) , for multiple line tool tip the skin looks ok. Most of my tooltip has single line it looks not too good .Do you have any workaround?

    Thanks.
    Eva

  5. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 22 Dec 2009 Link to this post

    Hi Eva ,

    Are you using RadToolTipManager with OnAjaxUpdate event or a WebService? If so, please try whether executing the following code in the OnClientResponseEnd event fixes the problem:

    <script type="text/javascript"
        
    function OnClientResponseEnd(sender, args) 
      setTimeout(function(){ 
      var active = Telerik.Web.UI.RadToolTip.getCurrent(); 
      var width = active._tableElement.offsetWidth; 
      active.set_width(width); 
      active.get_popupElement().style.width = width + "px"
      }, 0); 
        
        
        </script>


    Greetings,
    Svetlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Sam
    Sam avatar
    6 posts
    Member since:
    Jul 2010

    Posted 25 Aug 2010 Link to this post

    The problem Eva pointed out still exists.
     "I tried to change the width , it didn't work . Also the tooltip was loosing its border style(see the attachment)."

    Version 2010.2.713.35
  7. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 30 Aug 2010 Link to this post

    Hi Sam,

    I have attached an example solution which shows how to change the RadToolTip's size using jQuery. Could you please check it and let me know whether it fits your needs?

    Greetings,
    Fiko
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. ItsMe
    ItsMe avatar
    1 posts
    Member since:
    Nov 2015

    Posted 29 Mar in reply to Svetlina Anati Link to this post

    I was trying to dynamically set the height and width, which works fine if I don't have scroll bar set.  The height is fine with scrollbar, and width also adjusts depending on the content; however, when I hover over another item, the width keeps the previous content's width and thus, does not change.  If I don't have any scroll bar set (for vertical), then it's getting the correct width; otherwise, it keeps the width of whatever was hovered over previously and keeps that tooltip's width.

    It also works fine if I have scrolling set to Auto, so scroll bar appears both vertically and horizontally; but I want the width to be adjusted without scrollbar and height to have scrollbar.  

     Any ideas?  I have the below for RadTooltipmanager...

    function OnClientResponseEnd(sender, args) {

                    setTimeout(function () {
                        var active = Telerik.Web.UI.RadToolTip.getCurrent();
                        var width = active._tableElement.offsetWidth;
                        active.set_width(width);
                        active.get_popupElement().style.width = width + "px";

                        var maxHeight = 400;
                        var height = active._tableElement.offsetHeight < maxHeight ? active._tableElement.offsetHeight : maxHeight;
                        active.set_height(height);
                        active.set_contentScrolling(Telerik.Web.UI.ToolTipScrolling.Y);
                        active._show();

                    }, 0);

                }

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