Hello Dip,
The client methods set_width and set_height of the RadToolTip control work only before the tooltip is opened for the first time. That is why, in order to get the behavior you describe, you can use the following code:
<button id=
"longText"
onclick=
"ShowToolTip(this); return false;"
>
long text</button>
<button id=
"shortText"
onclick=
"ShowToolTip(this); return false;"
>
short text</button>
<telerik:RadToolTip ID=
"RadToolTip1"
runat=
"server"
HideEvent=
"ManualClose"
Position=
"TopLeft"
RelativeTo=
"Element"
>
TestTestTest TestTest
</telerik:RadToolTip>
<script type=
"text/javascript"
>
function
ShowToolTip(targetControl)
{
var
tooltip = $find(
"RadToolTip1"
);
if
(tooltip.get_targetControl() != targetControl)
{
if
(tooltip.isVisible())
{
tooltip.hide();
}
tooltip.set_targetControl(targetControl);
}
var
tooltipTable = tooltip._tableElement;
if
(targetControl.id ==
"longText"
)
{
if
(tooltipTable)
{
tooltipTable.style.width =
"400px"
;
tooltipTable.style.height =
"200px"
;
}
else
{
tooltip.set_width(
"400px"
);
tooltip.set_height(
"200px"
);
}
tooltip.set_contentScrolling(0);
}
else
{
if
(tooltipTable)
{
tooltipTable.style.width =
""
;
tooltipTable.style.height =
""
;
var
contentElement = tooltip.get_contentElement();
contentElement.style.width =
""
;
contentElement.style.height =
""
;
tooltip.get_popupElement().style.width =
""
;
}
tooltip.set_contentScrolling(5);
}
if
(tooltipTable) tooltip._adjustCallout();
tooltip.show();
}
</script>
Regards,
Tsvetie
the Telerik team