今天看人提问才发现TextBox放在updatepanel中,当点击Button时,在Button的click事件中得到焦点。。。

 

本来应该用TextBox1.Focus();就可以得到焦点果然得到焦点完全没有问题,但是新问题在文本框中没法切换输入法至中文输入

 

解决方法:

 

在TextBox1.Focus();得到焦点之后,后面再加入这段脚本注册:

 

ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "", "setTimeout(/"document.getElementById('TextBox1').focus();/", 1); ", true);



相关文章:

  • 2022-01-02
  • 2021-05-31
  • 2022-12-23
  • 2022-01-20
  • 2021-12-19
  • 2021-09-20
  • 2022-12-23
  • 2021-11-30
猜你喜欢
  • 2021-06-10
  • 2021-12-01
  • 2022-12-23
  • 2021-11-23
  • 2021-11-18
  • 2021-12-13
  • 2022-12-23
相关资源
相似解决方案