home *** CD-ROM | disk | FTP | other *** search
ASP.NET Web Form | 2004-02-01 | 1.5 KB | 37 lines |
- <%@ Page Language="C#" Trace="False" EnableSessionState="False" Debug="False" %>
- <script runat="server">
- void Page_Load(object sender, System.EventArgs e)
- {
- if (!IsPostBack)
- {
- HttpCookie myCookie = new HttpCookie("ckBanner");
- myCookie = Request.Cookies["ckBanner"];
- if (myCookie != null)
- chkStatus.Checked = Boolean.Parse(myCookie.Value);
- SaveCheckBoxStatus(sender,e);
- }
- ifrBanner.Visible = chkStatus.Checked;
- }
-
- void SaveCheckBoxStatus(object sender, EventArgs e)
- {
- HttpCookie myCookie = new HttpCookie("ckBanner");
- myCookie.Value = (chkStatus.Checked).ToString();
- myCookie.Expires = DateTime.Now.AddYears(1);
- Response.Cookies.Add(myCookie);
- }
- </script><?xml version="1.0" encoding="utf-8" ?>
- <!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" xml:lang="cs-CZ" lang="cs-CZ" dir="ltr">
- <head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <title>Práce s cookies</title>
- </head>
- <body>
- <form RunAt="server">
- <asp:CheckBox Id="chkStatus" AutoPostBack="True" OnCheckedChanged="SaveCheckBoxStatus" Text="zobrazovat banner" Checked="True" RunAt="server" />
- </form>
- <iframe Id="ifrBanner" Visible="false" src="http://interval.cz/podklady/ruzicka/aspx/647/ShowBanner.aspx" width="468" height="60" border="0" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" RunAt="server" />
- </body>
- </html>
-