
Partial Class _Default
    Inherits System.Web.UI.Page



    Protected Sub ddlBooks_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlBooks.SelectedIndexChanged
        If (ddlBooks.SelectedIndex <> -1) Then
            lblBooks.Text = String.Format("{0}, ISBN : {1}", ddlBooks.SelectedItem.Text, ddlBooks.SelectedValue)
        End If
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If (Not IsPostBack) Then

            ' Zbudowania dla listy dwuwymiarowej tablicy.       
            ' Pierwszy wymiar zawiera tytuł książki.      
            ' Drugi wymiar zawiera numer ISBN.  
            Dim bookList(,) As String = { _
                {"9780596513979", "Learning ASP.NET 2.0 with AJAX"}, _
                {"9780596510503", "Building a Web 2.0 Portal with ASP.NET 3.5"}, _
                {"9780596514822", "Head First C#"}, _
                {"9780596514242", "Programming ASP.NET AJAX"}, _
                {"059652756X", "Programming .NET 3.5"}, _
                {"9780596526993", "Programming WCF Services"} _
            }

            For i As Int32 = 0 To bookList.GetLength(0) - 1
                ' Add both text and value
                ddlBooks.Items.Add(New ListItem(bookList(i, 1), bookList(i, 1)))
            Next
        End If

    End Sub
End Class
