Getting value of selected item in list box as string

前端 未结 10 515
长情又很酷
长情又很酷 2020-12-01 09:31

I am trying to get the value of the selected item in the listbox using the code below, but it is always returning null string.

DataSet ds = searchforPrice(Co         


        
10条回答
  •  春和景丽
    2020-12-01 10:06

    You can Use This One To get the selected ListItme Name ::

    String selectedItem = ((ListBoxItem)ListBox.SelectedItem).Name.ToString();
    

    Make sure that Your each ListBoxItem have a Name property

提交回复
热议问题