this the code i have for chapter 11. it works except the drop down menu.
using System;
using System.Web;
using System.Web.UI.WebControls;
partial class FanClub : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
DisplayProfileProperties();
}
protected void btnCancelChanges_Click(object sender, System.EventArgs e)
{
DisplayProfileProperties();
}
protected void btnSaveChanges_Click(object sender, System.EventArgs e)
{
Profile.Theme = ((DropDownList)FCLoginview.FindControl("ThemeList" )).SelectedValue;
Profile.Name = ((TextBox)FCLoginview.FindControl("txtName")).Text ;
Profile.Address = ((TextBox)FCLoginview.FindControl("txtAddress")).T ext;
Profile.City = ((TextBox)FCLoginview.FindControl("txtCity")).Text ;
Profile.County = ((TextBox)FCLoginview.FindControl("txtCounty")).Te xt;
Profile.PostCode = ((TextBox)FCLoginview.FindControl("txtPostCode")). Text;
Profile.Country = ((TextBox)FCLoginview.FindControl("txtCountry")).T ext;
Profile.Mailings = ((CheckBox)FCLoginview.FindControl("chkMailing")). Checked;
Profile.Email = ((TextBox)FCLoginview.FindControl("txtEmail")).Tex t;
Profile.MemberName = ((TextBox)FCLoginview.FindControl("txtAlias")).Tex t;
Server.Transfer(SiteMap.CurrentNode.Url);
}
protected void FCLoginview_ViewChanged(object sender, System.EventArgs e)
{
DisplayProfileProperties();
}
private void DisplayProfileProperties()
{
TextBox NameBox = (TextBox)FCLoginview.FindControl("txtName");
if (NameBox != null)
{
((DropDownList)FCLoginview.FindControl("ThemeList" )).SelectedValue = Profile.Theme;
((TextBox)FCLoginview.FindControl("txtName")).Text = Profile.Name;
((TextBox)FCLoginview.FindControl("txtAddress")).T ext = Profile.Address;
((TextBox)FCLoginview.FindControl("txtCity")).Text = Profile.City;
((TextBox)FCLoginview.FindControl("txtCounty")).Te xt = Profile.County;
((TextBox)FCLoginview.FindControl("txtPostCode")). Text = Profile.PostCode;
((TextBox)FCLoginview.FindControl("txtCountry")).T ext = Profile.Country;
((CheckBox)FCLoginview.FindControl("chkMailing")). Checked = Profile.Mailings;
((TextBox)FCLoginview.FindControl("txtEmail")).Tex t = Profile.Email;
((TextBox)FCLoginview.FindControl("txtAlias")).Tex t = Profile.MemberName;
}
}
}
by the way, when you pick any value from the drop down menu, does it change the backgroud?
|