本來是想做個東西,只是用來測試抓取點數(shù)據(jù)的。。為了方便直接在頁面上放了兩個DropDownList聯(lián)動 把第一個DropDownList的AutoPostBack="True" 然后運行 但是回傳過后怎DropDownList1默認選擇的總是第一個,選擇其他的無效。。 if (Page.IsPostBack == false) { categories = bll.GetCategories("-2"); foreach (Category c in categories) { c.Ename = c.Ename.Trim(); c.Relation = c.Relation.Trim(); } this.DropDownList1.DataSource = categories; this.DropDownList1.DataTextField = "ename"; this.DropDownList1.DataValueField = "relation"; this.DropDownList1.DataBind(); } EnableViewState設置為true的 不知道為什么是這個效果。。迷惑中。。。自己也跟蹤了斷點,第二次已經(jīng)沒有重新綁定數(shù)據(jù)了。。
添加回答
舉報
0/150
提交
取消