你好,你是在什么事件里面取的Value呢,我通过下面的代码可以正常取到值:- protected void Page_Load(object sender, EventArgs e)
- {
- if (IsPostBack)
- {
- return;
- }
- DataTable dt = new DataTable();
- dt.Columns.Add("Value");
- dt.Columns.Add("Name");
- dt.Rows.Add(1, "C");
- dt.Rows.Add(2, "C#");
- dt.Rows.Add(3, "VB");
- dt.Rows.Add(4, "Java");
- this.C1ComboBox1.DataTextField = "Name";
- this.C1ComboBox1.DataValueField = "Value";
- this.C1ComboBox1.DataSource = dt;
- this.C1ComboBox1.DataBind();
- this.C1ComboBox1.SelectedIndex = -1;
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- String x = this.C1ComboBox1.SelectedItem.Value;
- }
复制代码 请检查Load中没有判断IsPostBack。
|