Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 1.0
This is the forum to discuss the Wrox book Beginning ASP.NET 1.0 with C# by Chris Goode, John Kauffman, Christopher L. Miller, Neil Raybould, S. Srinivasa Sivakumar, Dave Sussman, Ollie Cornes, Rob Birdwell, Matt Butler, Gary Johnson, Ajoy Krishnamoorthy, Juan T. Llibre, Chris Ullman; ISBN: 9780764543708
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 1.0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 6th, 2004, 10:07 AM
Authorized User
 
Join Date: Apr 2004
Location: Karachi, Sindh, Pakistan.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mahir
Default Ch15 CodeBehind

Hi,

I am encoutring the problem in the last example of Ch15 I am sending the error message please help.

If u need anything else please do tell me.

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   HeaderClass.Page_Load() +122
   System.Web.Util.ArglessEventHandlerDelegateProxy.C allback(Object sender, EventArgs e) +10
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +29
   System.Web.UI.Control.LoadRecursive() +92
   System.Web.UI.Control.LoadRecursive() +92
   System.Web.UI.Page.ProcessRequestMain() +724




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.0.3705.0; ASP.NET Version:1.0.3705.0


Thanks

Mahir Ali Ahmed
__________________
Mahir Ali Ahmed
  #2 (permalink)  
Old May 6th, 2004, 12:01 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hello,

Could you post the code? I don't have the book.

Thanks.
  #3 (permalink)  
Old May 8th, 2004, 01:58 AM
Authorized User
 
Join Date: Apr 2004
Location: Karachi, Sindh, Pakistan.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mahir
Default

here are the three files used in this program

main3.aspx
<%@ Page Language="VB" Debug="True" %>
<%@ Register TagPrefix="WroxUC" TagName="FeaturedBooks" Src="featuredbooks.ascx" %>
<%@ Register TagPrefix="WroxUC" TagName="Header" Src="header_CB.ascx" %>
<script runat="server">

    ' Insert page code here
    '

</script>
<html>
<head>
    <title>User Control Examples</title>
    <link href="style.css" type="text/css" rel="stylesheet" />
</head>
<body>
    <form method="post" runat="server">
        <WroxUC:Header id="MyHeader" runat="server"></WroxUC:Header>
        <br />
        <table>
            <tbody>
                <tr>
                    <td valign="top" width="70%">
                        This is the Wrox shop, where you can find out more about Wrox Books. The links take
                        you to a page on the wrox site where you can find out more details about each title.
                    </td>
                    <td width="30%">
                        <WroxUC:FeaturedBooks id="MyFeaturedBooks" runat="server"></WroxUC:FeaturedBooks>
                    </td>
                </tr>
            </tbody>
        </table>
    </form>
</body>
</html>

header_CB.vb

Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Collections

Public Class HeaderClass : Inherits UserControl

    Private Languages As New Hashtable()
    Private LanguageList As DropDownList
    Private WelcomeMessage As Label

    Public Sub Page_Load()

        Languages.Add("English", "Hello, and welcome to the shop")
        Languages.Add("French", "Bonjour, et bienvenue au magasin")
        Languages.Add("Spanish", "Buenas Dias, e bienvenido a la tienda")
        Languages.Add("German", "Guten Tag, und wilkommen ins geschaeft")

        If Not Page.IsPostBack Then

            LanguageList.DataSource = Languages.Keys
            Page.DataBind()

        End If

    End Sub

    Public Sub DropList_Changed(Sender As Object, E As EventArgs)

        WelcomeMessage.Text = Languages(LanguageList.SelectedItem.Text)

    End Sub

End Class

header_CB.ascx

<%@ Control Inherits="HeaderClass" Src="header_CB.vb" Language="VB" %>
<script runat="server">

    ' Insert page code here
    '

</script>
<table style="BACKGROUND-COLOR: #cc0033" cellspacing="0" width="100%" cellpading="10">
    <tbody>
        <tr>
            <td width="10%">
                <img src="logo.gif" align="left" />
            </td>
            <td width="60%">
                <asp:Label id="WelcomeMessage" runat="server"> Welcome
                to the Wrox Shop! </asp:Label></td>
            <td widt="30%">
                Select your Language:<br />
                <asp:DropDownList id="LanguageList" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropList_Changed"></asp:DropDownList>
                </td>
        </tr>
    </tbody>
</table>



Mahir Ali Ahmed
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Working Code - Ch15 slurp56 BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 3 April 24th, 2013 10:32 AM
Page 811; Ch15 Nick Y BOOK: Ivor Horton's Beginning Visual C++ 2005 0 July 24th, 2006 02:22 PM
Errata,book,Ch15,P470 din BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 1 March 14th, 2006 06:50 PM
Ch15 FeaturedBook.ascx mahir BOOK: Beginning ASP.NET 1.0 4 May 1st, 2004 09:09 AM
ch15: can't get JSTL to be recognized brownale2k JSP Basics 1 August 8th, 2003 04:32 PM



All times are GMT -4. The time now is 07:33 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.