Using List Controls LISTING protected void btnSubmit_Click(object sender, EventArgs e) { = ; } Show ListBox | 464 CHAPTER 10 Using List Controls LISTING @ Page Language C DOCTYPE html PUBLIC - W3C DTD XHTML EN http TR xhtml11 DTD script runat server protected void btnSubmit_Click object sender EventArgs e script html xmlns http 1999 xhtml head id Head1 runat server title Show ListBox title head body form id form1 runat server div asp ListBox id lstMovies DataSourceID srcMovies DataTextField Title DataValueField Id Rows 8 Runat server p asp Button id btnSubmit Text Submit OnClick btnSubmit_Click Runat server p hr asp Label id lblMovie Runat server asp SqlDataSource id srcMovies From the Library of Wow eBook Working with the ListBox Control 465 SelectCommand SELECT Id Title FROM Movies ConnectionString ConnectionStrings Movies Runat server div form body html The ListBox control in Listing includes a Rows property. The Rows property determines the number of list items that the ListBox displays. You can also configure the ListBox control to enable a user to select multiple items. This is illustrated in the page in Listing see Figure . FIGURE Selecting multiple list items. LISTING 10 @ Page Language C DOCTYPE html PUBLIC - W3C DTD XHTML EN http TR xhtml11 DTD script runat server From the Library of Wow eBook 466 CHAPTER 10 Using List Controls protected void btnSubmit_Click object sender EventArgs e foreach Listitem item in if li script html xmlns http 1999 xhtml head id Head1 runat server title Show Multiple ListBox title head body form id form1 runat server div asp ListBox id lstMovies DataSourceID srcMovies DataTextField Title DataValueField Id SelectionMode Multiple Runat server p asp Button id btnSubmit Text Submit OnClick btnSubmit_Click Runat server p hr asp Label id lblMovie EnableViewState false Runat server asp .