Click here to Skip to main content
15,921,660 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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.
[no name] 20-May-13 21:07pm    
So look those components up in the documentation and see if there are possibly some events that you allow you to know when something happens. The Click event for a checkbox seems like a good candidate. The SelectionChanged event for a listbox seems like a pretty good candidate as well.
David_Wimbley 20-May-13 21:13pm    
What platform is this, by your description no one knows. Is it Web Forms? Mvc? Winforms? Wpf? If you could specify then that would help with getting an answer.
KuttiSankar 20-May-13 21:17pm & In WebForm (creating Web Page)

1 solution

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

Try this and see.
Share this answer
KuttiSankar 21-May-13 10:51am    
My code is
if (DropDownList1.SelectedIndex > -1)
Label1.Text = DropDownList1.SelectedItem.Text;

Before My label text is
Select Your Control

I have only 2 items in drop down such as

But using your code it is not changing that text.

Help on this.

Thanks in Advance
KuttiSankar 3-Jun-13 11:28am    
No one can help me? anyway thanks CodeProject...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900