码迷,mamicode.com
首页 > Web开发 > 详细

Ext.Net TextField Enter事件

时间:2016-07-05 14:09:26      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:

(1)DirectEvents触发后台

<ext:TextField ID="txt_Upc" runat="server" Width="150">
<DirectEvents>
<KeyPress OnEvent="txtUpc_KeyPress">
<ExtraParams>
<ext:Parameter Name="keynum" Value="e.getKey()" Mode="Raw" />
</ExtraParams>
</KeyPress>
</DirectEvents>
</ext:TextField>

CS后台:

protected void txtUpc_KeyPress(object sender, DirectEventArgs e)
{
string key = e.ExtraParams["keynum"].ToString();
if (key == "13")
{

//do

}
}

(2)Listeners触发前台 

<ext:TextField ID="txt_Upc" runat="server" Width="150">
<Listeners>
<KeyPress Handler="if (e.getKey()==Ext.EventObject.ENTER){Ext.net.DirectMethods.TextKeyPress();e.stopEvent();}" />
<SpecialKey Handler="txtUpcEnter(e.getKey(),#{txt_Upc}.getValue());" />
</Listeners>
</ext:TextField>

JS:

function txtUpcEnter(keynum, value) {
if (keynum== "13") {
}
}

(3)DirectMethods-触发后台

(个人心得,我在扫描枪扫描控件自动Enter时DirectEvents方法不可用,Listeners触发前台方法可用)

<ext:TextField ID="txt_Upc" runat="server" Width="150">
<Listeners>
<KeyPress Handler="if (e.getKey()==Ext.EventObject.ENTER){Ext.net.DirectMethods.TextKeyPress();e.stopEvent();}" />
<SpecialKey Handler="Ext.net.DirectMethods.txtUpcEnter(e.getKey(),#{txt_Upc}.getValue());" />
</Listeners>
</ext:TextField>

CS后台:

[DirectMethod]
public void txtUpcEnter(string key, string value)
{
//
}

Ext.Net TextField Enter事件

标签:

原文地址:http://www.cnblogs.com/guopm/p/5643232.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!