比如说拖一个TextBox控件在页面上,双击该控件就会进入CS文件中的TextChanged事件方法
但如果我不要这个事件,想要TextBox的单击事件该怎么办,应该从那里选呀???

解决方案 »

  1.   

    单击就是 onfocus() 事件了  不过是前台
      

  2.   

    TextBox的WEB控件也没有onfocus事件和onclick事件呀,提示"属性onfocus不是TextBox控件的有效属性"
      

  3.   

    我自己找到方法了,呵呵,再定义一个有onclick事件的控件,让Textbox的onclick属性引用这个控件的onclick事件就行,具体原理不清楚,反正好使
     protected void Page_Load(object sender, EventArgs e)
        {
            TextBox1.Attributes["onclick"] = ClientScript.GetPostBackEventReference(Button1, null);
        }
     protected void Button1_Click(object sender, EventArgs e)
        {
            TextBox1.Text = "eeee";
        }