Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > BOOK: Beginning ASP.NET 1.1
|
BOOK: Beginning ASP.NET 1.1
This is the forum to discuss the Wrox book Beginning ASP.NET 1.1 with Visual C#.NET 2003 by Chris Ullman, John Kauffman, Chris Hart, Dave Sussman, Daniel Maharry; ISBN: 9780764557088
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 1.1 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 September 25th, 2004, 11:29 AM
Registered User
 
Join Date: Sep 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch-10 "Teams.aspx", repeater not rendered.

Hi,

I am working out on the examples given in the book. this problem occured in Ch-10 and in the Teams.aspx page.

When i am clicking on the Team A/Team B, the repeater control should display the players in the team. but nothing comes up.
i don't know where the problem is.. because i have typed the same code given in the book.
can anyone suggest where the problem could be.......?

thank you
jyo
 
Old September 27th, 2004, 07:10 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Can you post your code?

 
Old September 27th, 2004, 08:51 AM
Registered User
 
Join Date: Sep 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, i am including the code for the problem on Ch-10.(TeamA/TeamB)

<%@ Page Language="VB" %>
<script runat="server">

    dim SelectedTeam as String

    sub TeamList_ItemCommand(sender As Object, e as DataListcommandEventArgs)
        if e.CommandName.equals("showteam") then
          Selectedteam =Ctype(e.commandsource, linkbutton).text
          PlayersList.Datasource =getplayersbyteam(e.commandargument)
          PlayersList.Databind()
        end if
    end sub


        Function GetPlayersByTeam(ByVal teamID As Integer) As System.Data.IDataReader
            Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\BegASPNET11\"& _
    "wroxUnited\Database\WroxUnited.mdb"
            Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString )

            Dim queryString As String = "SELECT [Players].[PlayerName], [Positions].[PositionName], [PlayerTeam].[TeamID] "& _
    "FROM [Players], [Positions], [PlayerTeam], [Teams] WHERE (([PlayerTeam].[PlayerI"& _
    "D] = [Players].[PlayerID]) AND ([PlayerTeam].[TeamID] = [Teams].[TeamID]) AND (["& _
    "PlayerTeam].[Position] = [Positions].[PositionID]) AND ([PlayerTeam].[TeamID] = "& _
    "@TeamID))"
            Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand
            dbCommand.CommandText = queryString
            dbCommand.Connection = dbConnection

            Dim dbParam_teamID As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
            dbParam_teamID.ParameterName = "@TeamID"
            dbParam_teamID.Value = teamID
            dbParam_teamID.DbType = System.Data.DbType.Int32
            dbCommand.Parameters.Add(dbParam_teamID)

            dbConnection.Open
            Dim dataReader As System.Data.IDataReader = dbCommand.ExecuteReader(System.Data.CommandBehavio r.CloseConnection)

            Return dataReader
        End Function
    Sub Page_Load()

      TeamList.DataSource = GetTeams()
      TeamList.DataBind()

    End Sub


    Function GetTeams() As System.Data.IDataReader
      Dim connectionString As String = _
        "provider=Microsoft.jet.OLEDB.4.0; Ole Db Services=-4;" & _
        " Data Source= C:\BegASPNET11\wroxUnited\Database\WroxUnited.mdb"
      Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString )

      Dim queryString As String = "SELECT [Teams].[TeamID], [Teams].[TeamName], [Teams].[Notes] FROM [Teams]"
      Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand
      dbCommand.CommandText = queryString
      dbCommand.Connection = dbConnection

      dbConnection.Open
      Dim dataReader As System.Data.IDataReader = dbCommand.ExecuteReader(System.Data.CommandBehavio r.CloseConnection)

      Return dataReader
    End Function

</script>
<html>
<head>
</head>
<body>
    <form runat="server">
        <h1>Wrox United
        </h1>
        <h2>Teams
        </h2>
        <p>
            <table>
                <tbody>
                    <tr>
                        <td>
                            <asp:DataList id="TeamList" runat="server" OnItemCommand="TeamList_ItemCommand">
                                <ItemTemplate>
                                    <asp:linkbutton text='<%# Container.DataItem("TeamName") %>' CommandArgument='<%# Container.DataItem("TeamID") %>' id="TeamNameLink" style="color:darkred" CommandName="ShowTeam" runat="server" />
                                    <br />
                                    <asp:Label text='<%# Container.DataItem("Notes") %>' id="teamnotes" runat="server" />
                                </ItemTemplate>
                                <SeparatorTemplate>
                                    <br />

                                </SeparatorTemplate>
                            </asp:DataList>
                        </td>
                        <td style="VERTICAL-ALIGN: top">
                            <asp:Repeater id="PlayersList" runat="server">
                                <ItemTemplate>
                                    <asp:linkbutton text='<%# container.dataitem("PlayerName") %>' style="color:darkred" runat="server" width="120" />
                                    &nbsp;&nbsp; <asp:Label text='<%# Container.dataitem("PositionName") %>' id="Playerposition" runat="server" />
                                    <br />
                                </ItemTemplate>
                                <headerTemplate>
                                    Players in: <%= SelectedTeam %>

                                </headerTemplate>
                                <FooterTemplate>

                                </FooterTemplate>
                            </asp:Repeater>
                        </td>
                    </tr>
                </tbody>
            </table>

        </p>
    </form>
</body>
</html>





Similar Threads
Thread Thread Starter Forum Replies Last Post
C# Ch 10 Page 362 surefire BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 5 February 25th, 2008 01:55 PM
Ch. 10 Directory listing superkooi BOOK: Beginning ASP 3.0 1 March 3rd, 2005 07:39 AM
Problems with the editor example in ch 10 arne Beginning PHP 4 August 21st, 2004 02:24 PM





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