网页上放了服务器控件dropdownlist当选项改变时想要触法一个事件,怎么办?已将他的AutoPostBack设置为true。

解决方案 »

  1.   

    protectedvoidDropDownList1_SelectedIndexChanged(objectsender,EventArgse)
    {}
      

  2.   

    进行SelectedIndexChanged事件。。
      

  3.   

    SelectedIndexChanged事件可以啊你要实现什么功能啦.
      

  4.   

    TextChange事件为什么不可以?你要做什么?
      

  5.   

    如果Dropdownlist的选项改变的话我要让一个TextBox里的文字改变!
      

  6.   


    那肯定是可以的啊。。把清空的代码放在TextChanged中自动回发打开
      

  7.   


       protected void DropDownlistEdit_TextChanged(object sender, EventArgs e)
        {
           // Response.Write("<script>alert('" + Session["parentid"].ToString() + "');</script>");
            if (DropDownlistEdit.SelectedItem.Text == "--新建类别--")
            {
                this.TxtBox.Text = "";
            }
        }代码是这样的
      

  8.   

       protected void DropDownlistEdit_SelectedIndexChanged(object sender, EventArgs e)
        {
           // Response.Write("<script>alert('" + Session["parentid"].ToString() + "');</script>");
            if (DropDownlistEdit.SelectedItem.Text == "--新建类别--")
            {
                this.TxtBox.Text = "";
            }
        }
    应该是这个吧
      

  9.   

       protected void DropDownlistEdit_TextChanged(object sender, EventArgs e)
        {
           // Response.Write("<script>alert('" + Session["parentid"].ToString() + "');</script>");
            
                this.TxtBox.Text = "";
            
        }
    这个就对了,应该是你那个IF出了问题,要考虑页面刷新的问题
      

  10.   

    不行啊!要设置textbook的AutoPostBack属性吗?
      

  11.   

    textbox得值是在页面加载的时候付给的