I would like to Implement the following feature: when a user selects a movie from the dropdownlist and clicks on the ‘Add to cart’ button, the movie is then added into the list box below.
protected void addImageButton_Click(object sender, ImageClickEventArgs e)
{
string[] moviesArrayString = new string[10];
moviesArrayString[1] = "Badboy 2";
moviesArrayString[2] = "BadBoy 3";
moviesArrayString[3] = "The Godfather";
moviesArrayString[4] = "Inception";
moviesArrayString[5] = "The Shawshank Redemtion";
moviesArrayString[6] = "Star Wars";
moviesArrayString[7] = "The Metrix";
moviesArrayString[8] = "King Kong";
moviesArrayString[9] = "Point Break";
moviesArrayString[10] = "Top Gun";
cartListBox.Items.AddRange(moviesArrayString);
}
It give me some error and I couldn't figure out how to do so? error is index was outside the bound of arrays?