Could someone be kind enough to give an example of the javascript required to automatically set the focus to a textbox in a tooltip when the tip is displayed please? I can't work this out from the client-side docs (Q12008). thanks
5 Answers, 1 is accepted
0
Hello David Lennon,
I suggest using the RadToolTip's OnClientShow event to set the focus. You can achieve this by using the following javascript function:
Regards,
Svetlina
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
I suggest using the RadToolTip's OnClientShow event to set the focus. You can achieve this by using the following javascript function:
function OnClientShow(sender, eventArgs) |
{ |
setTimeout(function() |
{ |
var textBox = $get("<%= TextBox1.ClientID %>"); |
try |
{ |
if(textBox) |
textBox.focus(); |
} |
catch(e){}; |
} |
, 500); |
} |
<telerik:RadToolTip ID="RadToolTip1" runat="server" TargetControlID="HyperLink1" |
OnClientShow="OnClientShow"> |
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></telerik:RadToolTip> |
Regards,
Svetlina
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Ozzie
Top achievements
Rank 1
answered on 29 May 2009, 12:01 PM
yup... worked for me... THANKS
0
groggi
Top achievements
Rank 1
answered on 03 Feb 2010, 07:36 AM
Hi there
I'm using masterpages. where do I have to put the js function code block?
tx
sven
I'm using masterpages. where do I have to put the js function code block?
tx
sven
0
groggi
Top achievements
Rank 1
answered on 03 Feb 2010, 08:31 AM
I found out:
... (at the end):
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script language="javascript" type="text/javascript">
function OnClientShow(sender, eventArgs) {
setTimeout(
function() {
var textBox = $get("<%= paketscheinnummer.ClientID %>");
try {
if (textBox)
textBox.focus();
}
catch (e) { };
}
, 500);
}
</
script>
</
telerik:RadScriptBlock>
</asp:Content>
0
Hello groggi,
I am glad to hear that you managed to find solution yourself. The correct place to put the script is in the content page as you have found yourself because you are using code blocks (<%%>) and this is sever code which will throw an exception that the control is not found if it is put in a page which does not contain the control in the code block.
Best wishes,
Svetlina
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
I am glad to hear that you managed to find solution yourself. The correct place to put the script is in the content page as you have found yourself because you are using code blocks (<%%>) and this is sever code which will throw an exception that the control is not found if it is put in a page which does not contain the control in the code block.
Best wishes,
Svetlina
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.