如何获取要在Label中显示的值 [英] How can I get the Values to display in Label

查看:605
本文介绍了如何获取要在Label中显示的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有DropdownListbox,ListBox,Checkbox,Checkboxlist,Radiobutton,RadioButtonList。



我想知道如何显示所选值(如果我是单击复选框标签应显示您已单击复选框,如果我在列表框中选择任何值,标签的文本应更改为该列表框的文本。



请帮忙。



先谢谢。

解决方案

< pre lang =c#> protected void MyDropDown_SelectedIndexChanged( object sender,EventArgs e)
{
if (MyDropDown.SelectedIndex > -1)
{
MyLabel.Text = MyDropDown.SelectedItem.Text;
}
}





试试看看。


Hi, I have DropdownListbox, ListBox , Checkbox, Checkboxlist, Radiobutton, RadioButtonList.

I want to know how can i display the selected values (say if i click check box the label should display you have clicked check box, & if i select any value in list box, the text of the label should be changed to that list box''s text).

Pls help on this.

Thanks in Advance.

解决方案

protected void MyDropDown_SelectedIndexChanged(object sender, EventArgs e)
{
    if(MyDropDown.SelectedIndex > -1)
    {
        MyLabel.Text = MyDropDown.SelectedItem.Text;
    }
}



Try this and see.


这篇关于如何获取要在Label中显示的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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