p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning ASP.NET 1.0 (http://p2p.wrox.com/forumdisplay.php?f=26)
-   -   Chapter 10 -- Using Cookies (http://p2p.wrox.com/showthread.php?t=8567)

Michael Randall January 25th, 2004 04:13 PM

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;

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


Thanks much,


Imar January 25th, 2004 04:43 PM

I think this is causing the error:

My DropDownList

I am sure you mean:




Imar Spaanjaars
Everyone is unique, except for me.

Michael Randall January 25th, 2004 05:17 PM

Thanks, that was problem!

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

All times are GMT -4. The time now is 03:10 AM.

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