PDA

View Full Version : [CLOSED] TextField trigger directevet with "enter"



osef
Oct 01, 2013, 8:54 PM
Hi Team, How Ca I do to throw from TextField a DirectEvent when the user press key "enter".

Regards

Baidaly
Oct 01, 2013, 10:43 PM
Hello!

Look at this sample:


<%@ Page Language="C#" %>

<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>

<script runat="server">
protected void SpecialKeyHandler(object sender, DirectEventArgs e)
{
X.Msg.Alert("Enter", "Enter pressed").Show();
}
</script>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Live Updated Chart</title>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:TextField runat="server">
<DirectEvents>
<SpecialKey OnEvent="SpecialKeyHandler" Before="return e.getKey() == Ext.EventObject.ENTER;"></SpecialKey>
</DirectEvents>
</ext:TextField>
</body>
</html>

osef
Oct 01, 2013, 10:52 PM
Hello!

Look at this sample:


<%@ Page Language="C#" %>

<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>

<script runat="server">
protected void SpecialKeyHandler(object sender, DirectEventArgs e)
{
X.Msg.Alert("Enter", "Enter pressed").Show();
}
</script>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Live Updated Chart</title>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:TextField runat="server">
<DirectEvents>
<SpecialKey OnEvent="SpecialKeyHandler" Before="return e.getKey() == Ext.EventObject.ENTER;"></SpecialKey>
</DirectEvents>
</ext:TextField>
</body>
</html>



Thank you Baidaly this is working.