Click here to Skip to main content
15,886,547 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i'm working with asp.net. I have created a webform and i placed two controls 1)ListBox and 2)RadioButtonList

First user can select the item from the ListBox and then user will cllick on one of the items presented in RadioButtonList.

Question:
--------
I want to know which item selected in the ListBox.
I want to use it in the RadioButtonList1_SelectedIndexChanged event. How can i get the value of selected item in the ListBox.

Please provide solution

Thanks
Rajj
Posted

Use the SelectedItem[^] property.
 
Share this answer
 
use this

ListBox1.SelectedItem.Text


will return the selected item from the list
 
Share this answer
 
 
Share this answer
 
Get all selected item from listbox.

C#
for (int i = 0; i < Listbox1.Items.Count; i++)
{
      if(Listbox1.Items[i].Selected)
        txtBox.Text = Listbox1.Items[i].ToString();
           
}
 
Share this answer
 

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