0

我想用按钮显示从 DropDownList 输出的不同标签

select Item on DropDownList and click button to show output in label

谁能帮我解决这个问题?

4

3 回答 3

3
protected void Button1_Click(object sender, EventArgs e)
{
       Label1.Text = DropDownList1.SelectedValue;
}
于 2012-05-22T10:43:25.953 回答
1

把这个写在button click event

protected void Button1_Click(object sender, EventArgs e) { 
    label.text = ComboBox.SelectedText;
}
于 2012-05-22T10:37:56.687 回答
0
protected void Button1_Click(object sender, EventArgs e)
{
    lable1.Text=DropDownList1.SelectedValue.ToString();
}

或者你可以

   protected void Button1_Click(object sender, EventArgs e)
   {
       String input=DropDownList1.SelectedIndex >= 0 ? DropDownList1.SelectedItem.ToString() : "";
       lable1.Text=input;
   }
于 2012-05-22T10:58:24.477 回答