asp.net 中textbox为文本值改变时自动触发change事件

来源:互联网 发布:融资担保 网络业务 编辑:程序博客网 时间:2024/06/05 02:14

一: 添加一个隐藏button

<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" Width="16px"  />

 

 

二: 加入触发时的JS函数,让其按下第一步中添加的按钮

 

function myTextChanged()

     {              
    
     document.getElementById('<%=Button1.ClientID%>').click(); //触发input file的事件

     }

 

三:      EnableEventValidation 设置为"false"

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestApplyManage.aspx.cs" Inherits="TestApplyManage" EnableEventValidation ="false"  %>

 

 

后台:

1.Page_Load

TextBox1.Attributes.Add("onpropertychange", "myTextChanged()");

原创粉丝点击