Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the 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 July 2nd, 2004, 06:35 AM
Authorized User
 
Join Date: Jun 2004
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Default Wrox United Website CH10 Pages 350 & 351

I have a problem with the Repeater ID (PlayerList) being out of scope in my Sub TeamList_ItemCommand()
I am using Visual Studio instead of Webmatrix and am writing all Functions and Subs in the back file Teams.aspx.vb. I get the following error report in my Task List - 2 Build Error tasks shown (filtered)

***************************************
c:\inetpub\wwwroot\WroxUnited1\Teams.aspx.vb(83): Name 'PlayersList' is not declared.

c:\inetpub\wwwroot\WroxUnited1\Teams.aspx.vb(84): Name 'PlayersList' is not declared.
***************************************

what is the correct procedure for bringing this Object Name back into scope?

Note the coding for the first element of the Table on the Team.aspx page worked OK.
Can anyone tell me where to find, in Visual Studio, an equivalent Wizard to that used in the book for Webmatrix? I am writing this code copied from the book.
Many Thanks,
Edward.

 
Old July 2nd, 2004, 07:15 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

In Visual Studio, when you put a control on the page in the designer, it will also create a declaration in the code-behind file that looks like this:

Protected WithEvents myControl As System.Web.UI.WebControls.Repeater

This is what forms the link between the control that is instantiated declaratively in the markup. Once you have this, any code within the page class will be able to access the control.

Do you have this?
 
Old July 2nd, 2004, 11:32 AM
Authorized User
 
Join Date: Jun 2004
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi planoie, yes I can see the line that you listed and on running the program again it appears to have passed the Sub TeamList_ItemCommand() however ??

************************************************** ********************
    Protected WithEvents TeamList As System.Web.UI.WebControls.DataList
    Protected WithEvents PlayersList As System.Web.UI.WebControls.Repeater <-------

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object
************************************************** ********************
however I now have a new error with SelectedTeam shown as Private?

************************************************** ********************
Compiler Error Message: BC30390: 'WroxUnited1.Teams.SelectedTeam' is not accessible in this context because it is 'Private'.

Source Error:

Line 37: <headerTemplate>
Line 38: Players in:
Line 39: <%= SelectedTeam %>
Line 40:
Line 41: </headerTemplate>


Source File: c:\inetpub\wwwroot\WroxUnited1\Teams.aspx Line: 39
************************************************** ********************

I have declared this at the top of my back page as follows

************************************************** ********************
Public Class Teams
    Inherits System.Web.UI.Page
    Dim SelectedTeam As String

#Region " Web Form Designer Generated Code "
************************************************** ********************

is this the intended position for this declaration and is it "Private"? guess so!

I have changed the declaration to "Public SelectedTeam As String"
the code compiles but the new Repeater Object is not visible?

Any suggestions?






Similar Threads
Thread Thread Starter Forum Replies Last Post
Wrox United issues shanebbb BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 December 2nd, 2008 10:44 AM
Wrox United not working chris31martin BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 2 July 16th, 2008 09:00 AM
Re: Wrox United Logo dotnet411 BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 June 10th, 2006 09:46 AM
Wrox United chapter 4 diango BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 4 December 29th, 2005 12:47 PM





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