我想让页面载入的时候,直接把焦点设置到TextBox上面,应该如何设置呢?

解决方案 »

  1.   

    是方法哦,搞错了,
    this.TextBox1.Focus();
      

  2.   

    请问,这个代码写在哪里呢?没有类似于ASP.NET的PAGE_LOAD事件呀?
      

  3.   

    有啊,怎么会没有,你在<UserControl  标签后输入Loaded="新建事件",然后再事件中写代码就OK了。
      

  4.   

      public MainPage()
             {
                  this.Loaded += this.Page_Loaded;
         }private void Page_Loaded(object sender, EventArgs args)
             {
                InitializeComponent();
                this.TextBox1.Focus();
             }
      

  5.   

    <asp:textbox id='text1' runnut='server'></textbox>
    <script language='javascript'>
    documnet.getElementById('text1').focus();
    </script>