Welcome   |   ASP.NET   |   Web Services   |   How Do I...?   |   Class Browser   
  |   Font Size...      

profiles_vb\Anonymous.aspx

<%@ Page Language="VB" %>
<%@ Import Namespace="System.Drawing" %>

<script runat="server">
  Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
    If Not Page.IsPostBack Then
      If (Profile.PreferredBackgroundColor <> Color.Empty) Then
        ddlColor.SelectedValue = Profile.PreferredBackgroundColor.ToKnownColor().ToString()
        styleContainer.Style.Add(HtmlTextWriterStyle.BackgroundColor, Profile.PreferredBackgroundColor.ToKnownColor().ToString())
      End If
    End If
  End Sub

  Sub btnUpdatePreferences_Click(ByVal sender As Object, ByVal e As System.EventArgs)
    Profile.PreferredBackgroundColor = Color.FromName(ddlColor.SelectedValue)

    Response.Redirect(Request.Url.LocalPath)
  End Sub
</script>

<html>
  <head id="Head1" runat="server">
      <title>Setting Anonymous Profile Values</title>
  </head>
  <body>
      <form id="form1" runat="server">
      <div id="styleContainer" runat=server>
        Enter your preferred background color:
          <asp:dropdownlist id="ddlColor" runat="server">
            <asp:ListItem>Aqua</asp:ListItem>          
            <asp:ListItem>Blue</asp:ListItem>            
            <asp:ListItem>Fuchsia</asp:ListItem>            
            <asp:ListItem>Lime</asp:ListItem>
            <asp:ListItem>Red</asp:ListItem>
            <asp:ListItem>Silver</asp:ListItem>                    
            <asp:ListItem>Teal</asp:ListItem>            
            <asp:ListItem>Yellow</asp:ListItem>
          </asp:dropdownlist>
        <br />
        <asp:button id="btnUpdatePreferences" runat="server" text="Click to update background color" onclick="btnUpdatePreferences_Click"  />
        <br />
        <asp:Label id="lblIndicator" runat=Server />
      </div>
      </form>
  </body>
</html>