Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4.5 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-31180-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 26th, 2014, 10:43 PM
Authorized User
 
Join Date: Jun 2014
Posts: 16
Thanks: 7
Thanked 0 Times in 0 Posts
Default TIO - Working with List Controls

Hi there,

After step 9, page 121 "Notice how the VB.NET code underscore is needed to split the code over two lines.VB.NET requires the underscore if you want to move the Handles keyword to its own line"

Which underscore it's refering to?

ListControls.aspx

Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ListControls.aspx.vb" Inherits="Demos_ListControls" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>


        <asp:DropDownList ID="DropDownList1" runat="server">
            <asp:ListItem>C#</asp:ListItem>
            <asp:ListItem>Visual Basic</asp:ListItem>
            <asp:ListItem>CSS</asp:ListItem>
        </asp:DropDownList>

        <asp:CheckBoxList ID="CheckBoxList1" runat="server">
            <asp:ListItem>C#</asp:ListItem>
            <asp:ListItem>Visual Basic</asp:ListItem>
            <asp:ListItem>CSS</asp:ListItem>

        </asp:CheckBoxList>
    </div>
        
        <asp:Button ID="Button1" runat="server" Text="Button" />
&nbsp;
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
        
    </form>
    </body>
</html>
ListControls.aspx.vb


Code:
Partial Class Demos_ListControls
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load

    End Sub

    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Label1.Text = "In the DDL you selected " &
                              DropDownList1.SelectedValue & "<br />"


        For Each item As ListItem In CheckBoxList1.Items
            If item.Selected = True Then
                Label1.Text &= "In the CBL you selected " & item.Value & "<br />"
            End If
        Next
    End Sub
End Class
Help appreciated. Thks.

Cheers,
Mohamad





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 4 Try It Out Working with List Controls jpjamie BOOK: Beginning ASP.NET 4 : in C# and VB 15 November 26th, 2011 07:38 AM
Ch12 - TIO - Customizing GridView Controls p404 Step 9 & 10 AppleBoy BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 4 February 17th, 2011 10:33 AM
Ch8 - TIO#4 (Other List Controls) jecii BOOK: Beginning ASP.NET 2.0 and Databases 0 December 7th, 2007 07:57 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.