ASP.NET文本框自动回发未触发

ASP.NET文本框自动回发未触发,asp.net,Asp.net,经过搜索,我找到了很多建议,但没有一个能解决这个问题 <asp:TextBox runat="server" ID="uid" AutoPostBack="True" Text=""></asp:TextBox> 更新:我尝试过的其他文本框设置: <asp:TextBox runat="server" ID="uid" Text="" AutoPostBack="True" OnTextChanged="UidTextChanged"></asp:Te

经过搜索,我找到了很多建议,但没有一个能解决这个问题

<asp:TextBox runat="server" ID="uid" AutoPostBack="True" Text=""></asp:TextBox>
更新:我尝试过的其他文本框设置:

<asp:TextBox runat="server" ID="uid" Text="" AutoPostBack="True" OnTextChanged="UidTextChanged"></asp:TextBox>

protected void UidTextChanged(object sender, EventArgs e)
    {
        ClientScript.RegisterStartupScript(GetType(), "alert", "alert('it works');", true);
    }

受保护的无效UidTextChanged(对象发送方,事件参数e)
{
RegisterStartupScript(GetType(),“alert”,“alert('it works');”,true);
}



每当AutoPostBack设置为true时,我都会在浏览器控制台中收到以下错误:

"Uncaught TypeError: Property 'submit' of object #<HTMLFormElement> is not a function
__doPostBack
(anonymous function)"
“未捕获类型错误:对象的属性'submit'不是函数”
__背影
(匿名功能)

设置onblur属性后,我会收到完全相同的错误,只是它没有显示onblur的匿名函数。

您可以在文本框上添加
OnTextChanged=“TextBox1\u TextChanged”

注:重要的是设置事件触发,而不仅仅是AutoPostBack=“true”


您可以为它向onblur添加一个javascript事件<代码>onblur=''doPostBack('','');'

这将导致您的文本框在被标记出后出现回发


编辑:应该是“not”
将解释问题。

当我这样做时浏览器控制台中出现错误“uncaughttypeerror:Property'submit'of object#不是函数u doPostBack(匿名函数)“查看我所做的编辑。它需要”和“not”。同时删除
AutoPostBack=“True”
除了上面包含的页面加载和文本更改方法之外,没有任何内容可查看。其中几个选项对我有效。。。你能发布你的整个aspx页面吗?可能是页面上的某些内容导致了您的错误,而不是您的文本框。请参阅下面的pastebin链接。谢谢
 <asp:TextBox runat="server" ID="uid" AutoPostBack="True" Text="" onblur="__doPostBack('','');" OnTextChanged="UidTextChanged"></asp:TextBox>
 <asp:TextBox runat="server" ID="uid" AutoPostBack="True" Text="" onblur="__doPostBack('','');"></asp:TextBox>
"Uncaught TypeError: Property 'submit' of object #<HTMLFormElement> is not a function
__doPostBack
(anonymous function)"
<asp:TextBox runat="server" ID="uid" AutoPostBack="True" Text="" OnTextChanged="TextBox1_TextChanged"></asp:TextBox>
protected void TextBox1_TextChanged(object sender, System.EventArgs e) {  
    .....
}