当前位置: 代码迷 >> ASP.NET >> 为什么没有触发这个事件,该如何解决
  详细解决方案

为什么没有触发这个事件,该如何解决

热度:9234   发布时间:2013-02-26 00:00:00.0
为什么没有触发这个事件
protected   void   DropDownList1_SelectedIndexChanged(object   sender,   EventArgs   e)
                {
                        SqlConnection   sqlConn   =   new   SqlConnection( "... ");
                        sqlConn.Open();
                        string   strGetCustInfo   =   "select   ...   from   ...   where   ...= ' "   +   DropDownList1.Text   +   " ' ";
                        SqlCommand   sqlCmd   =   new   SqlCommand(strGetCustInfo,   sqlConn);
                        TextBox5.Text   =   sqlCmd.ExecuteScalar().ToString();
                        sqlCmd.Dispose();
                        sqlConn.Close();
                }
为什么我改变了DropDownList1的Item,没有触发这个事件?

------解决方案--------------------------------------------------------
DropDownList有个属性要设成True,A开头的,忘了叫什么了,好像是Allow什么的。。。
------解决方案--------------------------------------------------------
是autopostback,楼上的:)
  相关解决方案