如何在ASP中的标签控件上显示下拉列表中的值 [英] how to display values from dropdownlist on lable control in asp

查看:86
本文介绍了如何在ASP中的标签控件上显示下拉列表中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我...
我想在标签控件上显示dropdownlist的值.
我已经写了像bt这样的代码,它无法正常工作..............

Pls help me...
I want to display the value of dropdownlist on lable control.
I have writen the code like this bt this not working..............

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        Label1.Text = DropDownList1.SelectedItem.Text;
    }

推荐答案

使用Label1.Text = DropDownList1.Text;
而不是
Label1.Text = DropDownList1.SelectedItem.Text;
Use Label1.Text = DropDownList1.Text;
rather than
Label1.Text = DropDownList1.SelectedItem.Text;


您的代码没有问题,如果仍然无法使用,请检查页面的指令!
your Code has no problem, in case it is still not working then check the directives of page!!


检查下拉列表的编码,以便清楚地显示标签中所选项目对我来说是正确的
check the codings for dropdownlist clearly your codings to display the selected item in the label is correct for me


这篇关于如何在ASP中的标签控件上显示下拉列表中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆