Wrox Programmer Forums
|
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 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 January 25th, 2004, 04:13 PM
Authorized User
 
Join Date: Jan 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 10 -- Using Cookies

Hi, I am trying to to run the code for Using Cookies on page 423 of Beginning ASP.NET 1.0.

Unfortunately, I am getting a an error that reads, CS1002: ; expected.
However, I am not missing a semi-colon. Any thoughts on what is causing the error?

Here is the code that I typed in and tried to run:

<%@ Page Language="C#" %>
<script Language="c#" runat="server">
void Page_Load(object source, EventArgs e)
{
if (!(IsPostBack))
{
MyButton.Text = "Save Cookie";
My DropDownList.Items.Add("Blue");
My DropDownList.Items.Add("Red");
My DropDownList.Items.Add("Gray");
}
}
public void Click(object sender, EventArgs e)
{
HttpCookie MyCookie = new HttpCookie("Background");
MyCookie.Value = MyDropDownList.SelectedItem.Text;
Response.Cookies.Add(MyCookie);
}
</script>
<html>
<body>

<form id="CookieForm" methods="post" runat="server">
<asp:DropDownList id="MyDropDownList" runat="server" />
<asp:button id="MyButton" runat="server" OnClick="Click" />
</form>

</body>
</html>

Thanks much,

-Michael

 
Old January 25th, 2004, 04:43 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I think this is causing the error:

My DropDownList

I am sure you mean:

MyDropDownList

right?

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old January 25th, 2004, 05:17 PM
Authorized User
 
Join Date: Jan 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, that was problem!

I feel very silly now that I posted this in two separated forums!









Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 10 gogeo BOOK: Beginning Access 2003 VBA 1 January 22nd, 2006 09:41 AM
Chapter 10 columbiasmiles JSP Basics 0 May 17th, 2004 08:09 PM
Chapter 10, Cookies McMug BOOK: Beginning ASP.NET 1.0 3 March 30th, 2004 04:03 AM





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