Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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
  #1 (permalink)  
Old April 7th, 2008, 04:19 PM
Authorized User
 
Join Date: Apr 2008
Location: Rockville, MD, USA.
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 4 Pg 117 Try It Out Panel Display Question

When I followed the steps in this Try It Out example and I attempt to run this example by clicking on the check box the panel does not display as it should. I have attempted this exercise several times with the same result. I am using IE 7 and I think I have followed all of the steps correctly, however, I am new to this language.

Thank you for your help.

Here is the code from the Marked Up File

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Container.aspx.cs" Inherits="Demos_Container" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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

        <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True"
            oncheckedchanged="CheckBox1_CheckedChanged" Text="Show Panel" />
        <br />
        <asp:Panel ID="Panel1" runat="server" style="font-weight: 700" Visible="False">
            &nbsp;&nbsp;&nbsp; I am Visible now
        </asp:Panel>
&nbsp;

    </div>
    </form>
</body>
</html>

Code Behind File

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Demos_Container : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
    {
        Panel1.Visible = CheckBox1.Checked;
    }
}
  #2 (permalink)  
Old April 8th, 2008, 01:06 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Not sure what's going on. This is exactly as it should be; I copied your code in a new web form, and it works right away (as it should).

Maybe you don't have JavaScript enabled? You can check that through Tools Internet Options in IE. The configure the settings for the Zone your test web site is placed in.

Other things to check:

1. Modify the <body> tag like this:

<body onload="alert('Hello World');">

Do you see the alert message appear?

2. Check the final HTML of the page in the browser. Can you post that here? Are the controls like the checkbox converted into HTML like <input type="..." /> ?

Hope this helps,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 4: Using the Panel Control Steve1977 ASP.NET 3.5 Basics 3 September 14th, 2008 01:55 PM
Chapter 4 Pg 117 Try It Out workib ASP.NET 3.5 Basics 1 April 7th, 2008 12:49 AM
Chapter -4, page 117 Unable to add User savitur BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 6 October 18th, 2007 06:32 AM
Masterpage Update Panel Question jazzcatone ASP.NET 2.0 Basics 1 June 14th, 2007 09:20 AM





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