首页 > 解决方案 > 引用 system.web.ui 而不是 system.web.forms

问题描述

我有个问题。

我想在过滤器中捕获事件 KeyPress 。

<div class="row rowMarginTop ">
<div class="col-xs-12 col-md-7">
    <asp:Panel ID="pnlFilterCategory" runat="server" Visible="True">
        <asp:Label runat="server" ID="lblFilterCategory" Text="Rechercher une catégorie"></asp:Label>
        <asp:TextBox runat="server" ID="txtFilterCategory"></asp:TextBox>
        <asp:Button runat="server" ID="btnFilterCategory" Text="Rechercher" CssClass="btn btn-primary" />
    </asp:Panel>
</div>

但是在我后面的代码中我没有找到 KeyPress

Protected Sub txtFilterCategory_KeyPress(sender As Object, e As Global.System.Windows.Forms.KeyEventArgs) Handles txtFilterCategory.KeyPress
    If Not String.IsNullOrEmpty(txbFilterProduit.Text) Then
        Session("FilterExpression") = txbFilterProduit.Text
    End If

    RadTreeListF07.Rebind()
End Sub

我认为这是因为对于我的 txtFilterCategory 它说“Protected WithEvents txtFilterCategory As System.Web.UI.WebControls.TextBox Contrôle txtFilterCategory”

所以它不是 system.windows.form 的参考,我认为这是我的问题。

我的进口是

   Imports System.Windows.Forms
    Imports Telerik.Web.UI
Imports System.Data
Imports System.Collections.Generic
Imports System.Xml
Imports System.Web.Configuration
Imports System.IO
Imports System
Imports System.Web

所以我的问题是在我的代码隐藏中捕获 KeyPress 的方法是什么?

对不起我的英语我是法国人和初学者。

标签: vb.netwinformskeypress

解决方案


推荐阅读