【问题标题】:How to access "textChanged" event from text box that added to telerik Rad Grid?如何从添加到 Telerik Rad Grid 的文本框中访问“textChanged”事件?
【发布时间】:2011-10-03 11:55:59
【问题描述】:

您好,您知道如何访问添加到 radgrid 的文本框 textChanged 事件,该事件已绑定但用于捕获用户在该列的文本框中键入的任何与行相关的输入。发生回发时,我需要访问此数据服务器端。非常感谢您的想法谢谢您

【问题讨论】:

    标签: asp.net telerik-grid


    【解决方案1】:

    在 RadGrid 中确实没有太大变化。在 TextBox 上设置AutoPostBack="true",并创建一个OnTextChanged 事件处理程序:

    <telerik:RadGrid ID="RadGrid1" runat="server">                                                                
        <MasterTableView AutoGenerateColumns="false">      
            <Columns>
                <telerik:GridTemplateColumn>
                    <ItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" AutoPostBack="true" OnTextChanged="TextBox1_TextChanged" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
    

    在代码隐藏中:

    protected void TextBox1_TextChanged(object sender, EventArgs e)
    {
        TextBox txt = sender as TextBox;
        if (txt != null)
        {
            //some logic here
        }
    }
    

    【讨论】:

    • 实际上这在我的测试项目中运行良好。但不幸的是,当我将这些东西应用到主项目时它不起作用。它给出了 javascript 错误
    猜你喜欢
    • 2011-01-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多