asp.net中,怎么将DropDownList中选项和选项的值传到Literal中显示,就像图片
asp.net中,怎么将DropDownList中选项和选项的值传到Literal中显示,就像图片中那样...
asp.net中,怎么将DropDownList中选项和选项的值传到Literal中显示,就像图片中那样
展开
2个回答
展开全部
protected void Button1_Click(object sender, EventArgs e)
{
ListItem li = new ListItem();
li.Text =TextBox1.Text;
li.Value = TextBox2.Text;
DropDownList1.Items.Add(li);
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
Literal1.Text = "你选中的项为:" + DropDownList1.SelectedItem.Text + "值为:" + DropDownList1.SelectedItem.Value;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询