I have a listbox and I want to sort each item in that listbox from a-z and assign those code in a button. Do i need to assign the array to the listbox? and then use a loop ?
This is what I did:
protected void sortImageButton_Click(object sender, ImageClickEventArgs e)
{
string[] sort = new string[cartListBox.Items.Count];
for (int i = 0; i < sort.Length; i++)
{
sort[i] = cartListBox.Items[i].ToString();
Array.Sort(sort);
}
}
However, when I click the button, it doesnt do anything.