View Single Post
  #1 (permalink)  
Old January 25th, 2004, 04:13 PM
Michael Randall Michael Randall is offline
Authorized User
Join Date: Jan 2004
Location: Raliegh, NC, USA.
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;

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


Thanks much,