How do I check if selected value of the ListBox is not selected in C#?
- by Sahat
This code will display the selected value from the listbox. E.g. if I sellect Item 1 I will get the following output: You have selected Item 1.
Label1.Text = "You have selected " + DropDownList1.SelectedValue + "<br />";
But if I don't select anything and click on Submit button, I will get: You have selected
What would I need to make it display "You have not selected anything. Please select at least 1 item."
UPDATE: I am using ASP.NET WebForms.