tailieunhanh - Professional ASP.NET 3.5 in C# and Visual Basic Part 18

Professional in C# and Visual Basic Part 18. Building on the revolutionary release, adds several key new developer features including AJAX, LINQ, and a new CSS designer in Visual Web Developer 2008. The dramatic reduction in code that developers realized from the more than 50 new server controls in now allows developers the time to make their applications more interactive with AJAX, to work with data in their preferred language with LINQ, and to build visually attractive and consistent standards-based sites with CSS. . | Chapter 3 Web Server Controls DropDownList Page - Windows Internet Explorer I I I g http localhost53989 WebServerControls Defaultaspx X Gooole P 1 it DropDownList Page a 0 1 Page Tools You selected Airplane Boeing 777 Select transportation type Airplane Boeing 777 Select Options Done Internet I Protected Mode Off 100 - Figure 3-10 Visually Removing Items from a Collection The DropDownList ListBox CheckBoxList and RadioButtonList server controls give you the capability to visually remove items from the collection displayed in the control although you can still work with the items that are not displayed in your server-side code. The ListBox CheckBoxList and RadioButtonList controls are discussed shortly in this chapter. For a quick example of removing items create a drop-down list with three items including one that you will not display. On the postback however you can still work with the Listitem s Value or Text property as illustrated in Listing 3-11. Listing 3-11 Disabling certain Listitems from a collection VB @ page language VB script runat server Protected Sub DropDownList1_SelectedIndexChanged ByVal sender As Object ByVal e As You selected item number _ br You didn t select item number _ l .Value End Sub script html head runat server title DropDownList Server Control title head body form id form1 runat server 124 Chapter 3 Web Server Controls asp DropDownList ID DropDownList1 Runat server AutoPostBack True OnSelectedIndexChanged DropDownList1_SelectedIndexChanged asp ListItem Value 1 First Choice asp ListItem asp ListItem Value 2 Enabled False Second Choice asp ListItem asp ListItem Value 3 Third Choice asp ListItem asp DropDownList form body html C @ Page Language C script runat server protected void DropDownList1_SelectedIndexChanged object sender EventArgs e You selected item number br You .

TỪ KHÓA LIÊN QUAN