系统:ASP.NET2.0(C#) + AJAX
问题:
页面加上UpdatePanel后,点击ButtonID,设置另一TextID.Focus(),无效,请指教

解决方案 »

  1.   

    Response.Write("<script language='JavaScript'>document.getElementById('TextID').focus();'</scripy>");
      

  2.   

    在AJAX中,不可以用Response.Write,用ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "", "document.form1.TextBoxID.focus();", true)也不起作用
      

  3.   


     ScriptManager.RegisterClientScriptBlock(this, typeof(string), "", "document.form1.TextBoxID.focus();", true);
      

  4.   

    这样可以:
    ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "Err", "document.all.TextBoxID.focus();", true);
      

  5.   

    AJAX最简洁的控制焦点的办法:
    ScriptManager1.SetFocus("TextBox1");
      

  6.   


    按回车时将光标移到下一个文本框中http://topic.csdn.net/t/20041103/10/3516866.html
    http://topic.csdn.net/t/20051011/16/4319538.html
      

  7.   


    ScriptManager1.SetFocus("TextID");
      

  8.   

    按照koukoujiayi的方法ScriptManager1.SetFocus("TextBox1");成功!谢谢!
    在我看到此种方法前,受到dawnbear的this.textID.select()(该方法无效!)启发,我也发现一种方法,就是:
    ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "", "document.form1.TextBoxID.select();", true),测试有效!
    在此谢谢各位啦!现在结帖散分!