Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-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 February 27th, 2007, 02:49 PM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 142
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to vantoko
Default newsletter

Hi,

I want to enable the user profile in that way that a html version of the newsletter is selected by default when registring.

in my userprofile.aspx I have :
 <asp:ListItem Text="HTML versie" Value="Html" Selected="true" />
            <asp:ListItem Text="Geen abonnement" Value="None" />
            <asp:ListItem Text="Plain tekst" Value="PlainText" />

in my enum.cs (in newsletter folder) I have :
public enum SubscriptionType : int
   {
      None = 0,
      PlainText = 1,
      Html
   }

However, it is still set to None when the new user enters the profile page.
What am I doing wrong ?

tnx

koen

 
Old February 28th, 2007, 12:57 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is the profile being read and then populating that listbox, even the very first time? What value goes into the profile when the user is first created?

 
Old February 28th, 2007, 03:28 AM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 142
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to vantoko
Default

Here is my pageload and save function.
Do you see anything ?

protected void Page_Load(object sender, EventArgs e)
      {
         if (!this.IsPostBack)
         {
            ddlCountries.DataSource = Helpers.GetCountries();
            ddlCountries.DataBind();

            // if the UserName property contains an emtpy string, retrieve the profile
            // for the current user, otherwise for the specified user
            ProfileCommon profile = this.Profile;
            if (this.UserName.Length > 0)
               profile = this.Profile.GetProfile(this.UserName);

            ddlSubscriptions.SelectedValue = profile.Preferences.Newsletter.ToString();
            ddlLanguages.SelectedValue = profile.Preferences.Culture;
            txtFirstName.Text = profile.FirstName;
            txtLastName.Text = profile.LastName;
            ddlGenders.SelectedValue = profile.Gender;
            if (profile.BirthDate != DateTime.MinValue)
               txtBirthDate.Text = profile.BirthDate.ToShortDateString();
           ddlSkiType.SelectedValue = profile.SkiInfo.Type;
            txtWebsite.Text = profile.Website;
            txtStreet.Text = profile.Address.Street;
            txtCity.Text = profile.Address.City;
            txtPostalCode.Text = profile.Address.PostalCode;
            txtState.Text = profile.Address.State;
            ddlCountries.SelectedValue = profile.Address.Country;
            txtPhone.Text = profile.Contacts.Phone;
            txtFax.Text = profile.Contacts.Fax;
            txtAvatarUrl.Text = profile.Forum.AvatarUrl;
            txtSignature.Text = profile.Forum.Signature;
                     }
      }

public void SaveProfile()
      {
         // if the UserName property contains an emtpy string, save the current user's profile,
         // othwerwise save the profile for the specified user
         ProfileCommon profile = this.Profile;
         if (this.UserName.Length > 0)
            profile = this.Profile.GetProfile(this.UserName);

         profile.Preferences.Newsletter = (SubscriptionType)Enum.Parse(typeof(SubscriptionTy pe), ddlSubscriptions.SelectedValue);
         profile.Preferences.Culture = ddlLanguages.SelectedValue;
         profile.FirstName = txtFirstName.Text;
         profile.LastName = txtLastName.Text;
         profile.Gender = ddlGenders.SelectedValue;
         if (txtBirthDate.Text.Trim().Length > 0)
            profile.BirthDate = DateTime.Parse(txtBirthDate.Text);
        profile.SkiInfo.Type = ddlSkiType.SelectedValue;
         profile.Website = txtWebsite.Text;
         profile.Address.Street = txtStreet.Text;
         profile.Address.City = txtCity.Text;
         profile.Address.PostalCode = txtPostalCode.Text;
         profile.Address.State = txtState.Text;
         profile.Address.Country = ddlCountries.SelectedValue;
         profile.Contacts.Phone = txtPhone.Text;
         profile.Contacts.Fax = txtFax.Text;
         profile.Forum.AvatarUrl = txtAvatarUrl.Text;
         profile.Forum.Signature = txtSignature.Text;
                profile.Save();
      }







Similar Threads
Thread Thread Starter Forum Replies Last Post
subscription type in newsletter vantoko BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 6 September 24th, 2007 01:15 PM
Newsletter Mechanism vivek_inos ASP.NET 1.0 and 1.1 Professional 1 September 22nd, 2007 07:38 AM
Where is the newsletter option luisjeronimo BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 July 20th, 2007 03:16 PM
Newsletter sydneyausguy BOOK: Professional DotNetNuke ASP.NET Portals ISBN: 0-7645-9563-6 1 August 19th, 2005 05:23 PM
help with newsletter question AStuntz Beginning PHP 1 May 13th, 2004 06:54 PM





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