Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/146.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在多个回发事件后将焦点设置为文本框时出现问题_C#_Jquery_Asp.net_Updatepanel - Fatal编程技术网

C# 在多个回发事件后将焦点设置为文本框时出现问题

C# 在多个回发事件后将焦点设置为文本框时出现问题,c#,jquery,asp.net,updatepanel,C#,Jquery,Asp.net,Updatepanel,在我的页面上有一个更新面板和一个文本框和按钮在同一个更新面板内。在我将enter键设置为更新面板的默认按钮之后。多次回发后,实际上第三次回发后焦点设置为浏览器的“后退”按钮。我想将焦点设置到文本框的位置。我试图通过使用我在按钮事件的最后一行写的下面的选项将焦点设置到第一个文本框 1. option => Page.SetFocus(txtOrdertoAdd.ClientID); 2. option => txtOrdertoAdd.Focus(); 3. option =>

在我的页面上有一个更新面板和一个文本框和按钮在同一个更新面板内。在我将enter键设置为更新面板的默认按钮之后。多次回发后,实际上第三次回发后焦点设置为浏览器的“后退”按钮。我想将焦点设置到文本框的位置。我试图通过使用我在按钮事件的最后一行写的下面的选项将焦点设置到第一个文本框

1. option => Page.SetFocus(txtOrdertoAdd.ClientID);
2. option => txtOrdertoAdd.Focus();
3. option => Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", "SetFocus(" + txtOrdertoAdd.ClientID + ");</script>");
4. option => ScriptManager.RegisterStartupScript(this, this.GetType(), "selectAndFocus", "$get('" + txtOrdertoAdd.ClientID + "').focus();", true);
1。option=>Page.SetFocus(txtorad.ClientID);
2.option=>txtordoadd.Focus();
3.option=>Page.ClientScript.RegisterStartupScript(this.GetType(),“Script”,“SetFocus(“+txtOrdertoAdd.ClientID+”);”;
4.option=>ScriptManager.RegisterStartupScript(this,this.GetType(),“selectAndFocus”,“$get(““+txtordoadd.ClientID+”).focus();”,true);
我面临着这个有线问题,特别是在IE中,它在fire fox和chrome中运行良好。谁能告诉我如何解决这个问题

<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
    <div>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                 <asp:Panel runat="server" ID="Panel1" DefaultButton="Button1">
                     <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                     <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
                </asp:Panel>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>
</body>
在IE11上运行良好

你能展示一下你有什么吗

protected void Button1_Click(object sender, EventArgs e)
{
    TextBox1.Text = TextBox1.Text + "1";
    TextBox1.Focus();
}