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 26th, 2004, 05:43 PM
Authorized User
 
Join Date: Jun 2004
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Default Progressing towards the Dawn with Visual studio


User Controls in VS

The Navigation Bar of Wrox United has a button btnApplyTheme, which in chapter 12 Page 452 the HTML is copied from Default.aspx with the other page links into the new Header.ascx file, and the Sub btnApplyTheme_Click() from the back page into the back page of Header.ascx

Unfortunately the back page of Header.ascx doesn't have a 'Web Form Designer Generated Code' section for the following line to be copied into:

'Protected WithEvents ddlTheme As System.Web.UI.WebControls.DropDownList'

which produces an error.
Can anyone tell me how the above Sub is linked to the front page of Header.ascx in Visal studio?

Edward.

 
Old July 26th, 2004, 06:03 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Is there any way you can post relevant code for this?

Brian
 
Old July 27th, 2004, 09:07 AM
Authorized User
 
Join Date: Jun 2004
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Brian, thanks for your response to my topic. Just when I think I am getting used to the way Visual Studio works it whacks me! I have been adding the Navigation Bar to my copy project of WroxUnited from the book 'Beginning ASP.NET 1.1' Pages 451 to 455, there is evidently a big difference between the way VS works from that of Web Matrix, while script is allowed code is normally added to a back page. Controls coding added to the back page has a link to the front page via lines found in the '#Region " Web Form Designer Generated Code "' section, these lines are normally written by VS at the time when Controls are added in the design view of the front page. If code is written in the HTML view of the front page or in the back page the above link lines are not added. In this instance when the NavBar.ascx file was coded the code was copied in from Default.aspx, in the back page of NavBar.ascx there was no location for the Control link code lines ('#Region " Web Form Designer Generated Code "') so I was in a quandry what to do to make the link and set the Control working.
Today when I received your reply, I opened the project to copy code into this responce to find the error reported different to that seen when working with the project, VS had in fact added the missing code, I have corrected the revised error and the project is working and I am back on track.
The back page code is as follows:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
Public Class Navbar
    Inherits System.Web.UI.UserControl

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents lnkTeams As System.Web.UI.WebControls.HyperLink
    Protected WithEvents lnkPlayers As System.Web.UI.WebControls.HyperLink
    Protected WithEvents lnkGames As System.Web.UI.WebControls.HyperLink
    Protected WithEvents lnkResults As System.Web.UI.WebControls.HyperLink
    Protected WithEvents lnkMerchandise As System.Web.UI.WebControls.HyperLink
    Protected WithEvents lnkChat As System.Web.UI.WebControls.HyperLink
    Protected WithEvents ddlTheme As System.Web.UI.WebControls.DropDownList <-- This is the link that was reported missing in the initial effort. However this whole section (Region) had to be added by VS!
    Protected WithEvents btnApplyTheme As System.Web.UI.WebControls.Button
    Protected WithEvents chkRememberStylePref As System.Web.UI.WebControls.CheckBox

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
    End Sub

    Sub btnApplyTheme_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnApplyTheme.Click

        Session("SelectedCss") = ddlTheme.SelectedItem.Value

        If chkRememberStylePref.Checked Then

            Dim CssCookie As New HttpCookie("PreferredCss")
            CssCookie.Value = ddlTheme.SelectedItem.Value
            CssCookie.Expires = Now.AddSeconds(20)
            Response.Cookies.Add(CssCookie)

        End If
    End Sub

End Class

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
Many Thanks Brian for your response and interest.

Edward.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Studio VS. Visual Web Developer expr Astrocloud BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 2 November 23rd, 2008 03:10 PM
FTP in Visual Studio 2005 Pro (Visual Basic) shoopes VB How-To 1 June 29th, 2006 02:08 PM
Visual Studio 2003 vs. Visual Studio 2005 eitanbarazani C# 2005 4 May 9th, 2006 01:34 AM
Visual Studio .net2003 and Visual Studio 2005 Gert Visual C++ 1 January 24th, 2006 05:10 AM
Visual studio 6 or visual studio .NET chaitannyam Visual C++ 1 November 13th, 2005 09:26 AM





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