Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 27th, 2007, 02:49 PM
Friend of Wrox
 
Join Date: Aug 2006
Location: , , .
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

  #2 (permalink)  
Old February 28th, 2007, 12:57 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Atlanta, Georgia, USA.
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?

  #3 (permalink)  
Old February 28th, 2007, 03:28 AM
Friend of Wrox
 
Join Date: Aug 2006
Location: , , .
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();
      }


 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 06:12 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.