Asp.net 文本框文本更改事件
我有一个表单,我想在该文本框的文本更改事件上调用一个存储过程, 你有什么建议吗。Asp.net 文本框文本更改事件,asp.net,c#-4.0,Asp.net,C# 4.0,我有一个表单,我想在该文本框的文本更改事件上调用一个存储过程, 你有什么建议吗。 提前感谢。您只需处理以下问题: 请注意,如果(!IsPostBack),则应仅将控件数据绑定到,否则不会触发事件。因此,例如在页面加载: protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataBindForm(); // which sets the `Text` property
提前感谢。您只需处理以下问题: 请注意,如果(!IsPostBack),则应仅将控件数据绑定到
,否则不会触发事件。因此,例如在页面加载:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataBindForm(); // which sets the `Text` property of this TextBox among others
}
}
您使用什么技术来编写表单?是网络表单吗?MVC?您可以编写服务(WCF或遗留服务)方法并通过JavaScript(jQuery)AJAX请求它。
protected void TextBox1_TextChanged(Object sender, EventArgs e)
{
TextBox txt = (TextBox) sender;
// call your stored-procedure
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataBindForm(); // which sets the `Text` property of this TextBox among others
}
}