运行项目时,下拉菜单中的数据是和数据库中绑定的,
可是下拉菜单仍然可以获得光标进行打入数据,
或修改原有数据,如何避免,是不是有什么属性。

解决方案 »

  1.   

    廠別:<select id="SelFact_No" runat="server" class="text" style="width:65px;"></select>/// <summary>
        /// 得到廠別
        /// </summary>
        /// <returns></returns>
        private void GetFact_No()
        {
            DataSet ds = new DataSet();
            ds = test.GetFact_No();
            if (ds.Tables[0].Rows.Count == 0) return;
            this.SelFact_No.DataSource = ds.Tables[0];
            this.SelFact_No.DataValueField = ds.Tables[0].Columns["Fact_no"].ToString();
            this.SelFact_No.DataTextField = ds.Tables[0].Columns["fact_Name"].ToString();
            this.SelFact_No.DataBind();
        }
      

  2.   

    comboBox1.DropDownStyle   =   System.Windows.Forms.ComboBoxStyle.DropDownList;
      

  3.   

    开发页面中选中下拉柜控件,按F4键,有个属性叫DropDownStyle,选择DropDownList
    或在窗体的frmload事件中加入楼上的代码:
    comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
      

  4.   

    DropDownStyle
    是这个,设定试试,可以解决的。