有一个panel是隐藏的,点击一个按钮就显示,点击这个按钮的时候如何让里面的文本框如何获得鼠标焦点
textbox1.Focus();
这样为什么不行?

解决方案 »

  1.   

    获得焦点的代码要在Panel可见后设置,否则无效:
    this.panel1.Visible = true;
    this.textBox1.Focus();
      

  2.   

    protected void Page_Load(object sender, EventArgs e)
     {
    this.Textbox1.Attributes.Add("onfocus", "函数名('Textbox1');");}
      

  3.   

    什么函数名啊.说了是一个panel
    this.panel1.Visible = true;
    this.textBox1.Focus();这种方法试了,不行 我一开始就是用的这个,不行我才来问的
      

  4.   

    TextBox tb=new (TextBox)panel.findcontrol("textBox1") 
    tb.Focus(); 
    不知道行不?