首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

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

2012-03-19 
为什么没有触发这个事件protectedvoidDropDownList1_SelectedIndexChanged(objectsender,EventArgse){SqlC

为什么没有触发这个事件
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,楼上的:)

热点排行