<p>how do i check if an item is selected or not in my listbox?
so i have a button remove, but i only want that button to execute if an item is selected in the list box. im using asp.net code behind C#. I'd prefer if this validation occurred on the server side.</p>

<p>cheers..</p>

On the callback for the button click, just check if the selected index of the list box is greater than or equal to zero.
```
```
protected void removeButton_Click( object sender, EventArgs e )
{
    if (listBox.SelectedIndex >= 0)
    {
        listBox.Items.RemoveAt( listBox.SelectedIndex );
    }
}
```
```