TAILIEUCHUNG - Professional ASP.NET 1.0 Special Edition- P10

Professional Special Edition- P10:Those of us who are Microsoft developers can't help but notice that .NET has received a fair amount of visibility over the last year or so. This is quite surprising considering that for most of this period, .NET has been in its early infancy and beta versions. I can't remember any unreleased product that has caused this much interest among developers. And that's really an important point, because ignoring all the hype and press, .NET really is a product for developers, providing a great foundation for building all types of applications | br End Sub Notice how in this case we simply access the SelectedItem property of the list control which returns a reference to the first item in the list that is selected. Extracting Multiple Selected Values from List Controls Both of the lists in the previous example allow only a single selection to be made. This is always the case with a RadioButtonList but we can specify that a ListBox control will accept multiple selections by setting the SelectionMode property to the value . And of course in a CheckBoxList we will usually allow multiple item selection as this is generally the sole reason for using this type of control. We extract multiple selected values from a list control using exactly the same technique as we did with the HtmlSelect control in the previous section. We iterate through all the ListItem elements in the Items collection exposed by the list control checking the Selected property of each one and extracting the Text and Value properties for those that are selected Sub MyCode objSender As Object objArgs As EventArgs Dim strResult As String strResult The following items were selected br Dim objItem As Listitem For Each objItem in If Then strResult br End If Next strResult End Sub Other Rich Controls To finish off this chapter we will look briefly at three other controls that are provided with . These are called rich controls because they create the entire HTML required to implement a complex task in one simple operation. A typical example of this is the Calendar control which can create a complete working calendar within a web page. All you do is add the control to your page and set a few properties. The three controls we ll be covering here are Control Description ASP AdRotator Displays an advertisement banner that changes on a predefined schedule. ASP Calendar Displays a calendar showing single .