Jun 02, 2010, 10:11 AM
[CLOSED] KeyDown Event Not Firing
I am using version v 0.8.1 of Coolite and have found this strange behaviour which I have a workaround for.
The html below just shows 2 controls on a page, the 2nd control txtWhy is hidden.
Now, comment out the hidden control and try again.
The Keydown event does not seem to fire...
Is this something I have done on my code, or a bug?
The html below just shows 2 controls on a page, the 2nd control txtWhy is hidden.
<script type="text/javascript">
function CheckKeyDown(keypressed) {
var isEnter = keypressed.getKey() == keypressed.ENTER;
return isEnter;
}
</script>
<ext:Panel runat="server" ID="ww" Border="false">
<Body>
<ext:FormLayout ID="FormLayout2" runat="server" LabelAlign="Left" LabelWidth="120">
<ext:Anchor>
<ext:NumberField ID="txtInput" runat="server" FieldLabel="Input" AllowDecimals="false"
EnableKeyEvents="true" Width="400">
<AjaxEvents>
<KeyDown OnEvent="txtInput_KeyDown" Before="return CheckKeyDown(params[1]);">
</KeyDown>
</AjaxEvents>
</ext:NumberField>
</ext:Anchor>
<ext:Anchor>
<ext:TextField ID="txtWhy" Hidden="true" runat="server" >
</ext:TextField>
</ext:Anchor>
<ext:Anchor>
<ext:TextArea ID="txtOP" runat="server" Width="400" Height="400" FieldLabel="Output">
</ext:TextArea>
</ext:Anchor>
</ext:FormLayout>
</Body>
</ext:Panel>
The code behind is simple as well:Sub txtInput_KeyDown(ByVal sender As Object, ByVal e As AjaxEventArgs)
If Not txtInput.Text = Nothing Then
txtOP.Text = txtOP.Text & vbNewLine & txtInput.Text
txtInput.Clear()
txtInput.Focus()
End If
End Sub
This, when run will build up the contents of what you type in the top control in the bottom control, easy.Now, comment out the hidden control and try again.
The Keydown event does not seem to fire...
Is this something I have done on my code, or a bug?