2011-05-19 50 views
0

嗨,我需要顯示一個數據下拉列表,但禁用,我的問題,然後,儘管我設置了唯一的值,我需要在應用程序的開始時顯示,當我設置啓用虛假數據它已清楚,所以我需要知道如果退出的另一種方式來禁用下拉,但與數據。由於dropdownlist的值,但禁用

我的代碼

protected void Page_Load(object sender, EventArgs e) 
{ 
      //Initialize the combo 
      Dictionary<int,String> estate = new Dictionary<int,String>(); 
      estadosVenezuela.Add(0,"Pick a state"); 
      DropDownList2.DataValueField = "Key"; 
      DropDownList2.DataTextField = "Value"; 
      DropDownList2.DataBind(); 
      DropDownList2.Enabled = false; 
} 

我需要這些值選擇一個狀態出現的,但隨着下拉列表殘疾人

+0

EstadosVenezuela是否被添加到DropDownList2?什麼是EstadosVenezuela? – 2011-05-19 15:54:13

回答

4

你需要指定DropDownList2.DataSource。現在它沒有被設置,因此列表中沒有任何內容。