用于标记输出 C# 的下拉列表
本文关键字:下拉列表 输出 用于 | 更新日期: 2023-09-27 18:35:01
我想显示从 DropDownList 输出的不同标签
select Item on DropDownList and click button to show output in label
谁能帮我解决这个问题?
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = DropDownList1.SelectedValue;
}
只需将其写在button click event
protected void Button1_Click(object sender, EventArgs e) {
label.text = ComboBox.SelectedText;
}
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;
}