⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fanclub.aspx.cs

📁 ASP.NET2.0(C#篇)经典教程的源码...本源码很好的实现了购物车....编码规范和类的设计具有很好的借鉴性!
💻 CS
字号:
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")).Text;
    Profile.City = ((TextBox)FCLoginView.FindControl("txtCity")).Text;
    Profile.County = ((TextBox)FCLoginView.FindControl("txtCounty")).Text;
    Profile.PostCode = ((TextBox)FCLoginView.FindControl("txtPostCode")).Text;
    Profile.Country = ((TextBox)FCLoginView.FindControl("txtCountry")).Text;
    Profile.Mailings = ((CheckBox)FCLoginView.FindControl("chkMailing")).Checked;
    Profile.Email = ((TextBox)FCLoginView.FindControl("txtEmail")).Text;
    Profile.MemberName = ((TextBox)FCLoginView.FindControl("txtAlias")).Text;
    Server.Transfer(SiteMap.CurrentNode.Url);
  }

  protected void FCLoginView_ViewChanged( object sender,  System.EventArgs e)
  {
    DisplayProfileProperties();
  }

  private void DisplayProfileProperties()
  {
    DropDownList ThemeList = (DropDownList)FCLoginView.FindControl("ThemeList");

    // TODO
    // there should be a better way of detecting whether a certain template is in action
    // as it is we have to just see if the control exists, and if so we can set its value
    if (ThemeList != null)
    {
      ThemeList.SelectedValue = Profile.Theme;
      ((TextBox)FCLoginView.FindControl("txtName")).Text = Profile.Name;
      ((TextBox)FCLoginView.FindControl("txtAddress")).Text = Profile.Address;
      ((TextBox)FCLoginView.FindControl("txtCity")).Text = Profile.City;
      ((TextBox)FCLoginView.FindControl("txtCounty")).Text = Profile.County;
      ((TextBox)FCLoginView.FindControl("txtPostCode")).Text = Profile.PostCode;
      ((TextBox)FCLoginView.FindControl("txtCountry")).Text = Profile.Country;
      ((CheckBox)FCLoginView.FindControl("chkMailing")).Checked = Profile.Mailings;
      ((TextBox)FCLoginView.FindControl("txtEmail")).Text = Profile.Email;
      ((TextBox)FCLoginView.FindControl("txtAlias")).Text = Profile.MemberName;
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -