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

OnClientKeyPressing not working on Firefox 2 or 3

1 Answer 60 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Russell
Top achievements
Rank 1
Russell asked on 19 Nov 2008, 09:56 AM
We have created a page that has a RadTreeView and have subscribed the OnClientKeyPressing event to a function. On IE 6 and 7 the event fires showing an alert but on Firefox it does nothing.

I have attached the aspx page contents below.

Regards
Russell

<%

@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="TreeTest.WebForm2" %>

 

<%

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

 

<!

 

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<

 

html xmlns="http://www.w3.org/1999/xhtml">

 

<

 

head runat="server">

 

 

<title></title>

 

</

 

head>

 

<

 

body>

 

 

<form id="form1" runat="server">

 

 

<asp:ScriptManager ID="ScriptManager1" runat="server">

 

 

</asp:ScriptManager>

 

 

 

<script type="text/javascript">

 

 

function test() {

 

alert(

'hello');

 

}

 

 

</script>

 

 

 

<div>

 

 

<telerik:RadTreeView ID="RadTreeView1" runat="server" EnableDragAndDrop="True" Skin="Outlook"

 

 

MultipleSelect="True" OnClientKeyPressing="test">

 

 

<Nodes>

 

 

<telerik:RadTreeNode runat="server" Text="Root RadTreeNode1">

 

 

<Nodes>

 

 

<telerik:RadTreeNode runat="server" Text="Child RadTreeNode 1">

 

 

</telerik:RadTreeNode>

 

 

<telerik:RadTreeNode runat="server" Text="Child RadTreeNode 2">

 

 

</telerik:RadTreeNode>

 

 

<telerik:RadTreeNode runat="server" Text="Child RadTreeNode 3">

 

 

</telerik:RadTreeNode>

 

 

</Nodes>

 

 

</telerik:RadTreeNode>

 

 

<telerik:RadTreeNode runat="server" Text="Root RadTreeNode2">

 

 

<Nodes>

 

 

<telerik:RadTreeNode runat="server" Text="Child RadTreeNode 1">

 

 

<Nodes>

 

 

<telerik:RadTreeNode runat="server" Text="Child RadTreeNode 1">

 

 

<Nodes>

 

 

<telerik:RadTreeNode runat="server" Text="Child RadTreeNode 1">

 

 

</telerik:RadTreeNode>

 

 

<telerik:RadTreeNode runat="server" Text="Child RadTreeNode 2">

 

 

</telerik:RadTreeNode>

 

 

</Nodes>

 

 

</telerik:RadTreeNode>

 

 

</Nodes>

 

 

</telerik:RadTreeNode>

 

 

</Nodes>

 

 

</telerik:RadTreeNode>

 

 

</Nodes>

 

 

<CollapseAnimation Type="OutQuint" Duration="100"></CollapseAnimation>

 

 

<ExpandAnimation Duration="100"></ExpandAnimation>

 

 

</telerik:RadTreeView>

 

 

</div>

 

 

</form>

 

</

 

body>

 

</

 

html>

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 20 Nov 2008, 06:04 PM
Hello Russell,

Two things are required in order for the keyPressing event to fire in FireFox:
  1. The TabIndex property of RadTreeView should be set so it can receive the focus
  2. The TreeView should be focused (for example by pressing the tab key until the "focus" box appears around the treeview).
You can also focus the treeview when the user clicks a node like this:

<script>
function focusTreeView(sender, args)
{
    sender.get_element().focus();
}
</script>

    <telerik:RadTreeView ID="RadTreeView1" runat="server" EnableDragAndDrop="True" Skin="Outlook"
OnClientKeyPressing="test" TabIndex="1" OnClientNodeClicked="focusTreeView">
Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
TreeView
Asked by
Russell
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or