protected void Page_Load(object sender, EventArgs e) { oDB = new DB.Data(); error.Style.Add("display", "none"); result.Style.Add("display", "none"); string CreateMsg = ""; CreateMsg = Request.QueryString["Created"]; if (CreateMsg == "Y") { result.Style.Add("display", ""); result.Text = "The profile has been created."; PropertyInfo isreadonly = typeof(System.Collections.Specialized.NameValueCollection).GetProperty( "IsReadOnly", BindingFlags.Instance | BindingFlags.NonPublic); // make collection editable isreadonly.SetValue(this.Request.QueryString, false, null); // remove this.Request.QueryString.Remove("Created"); } if (!IsPostBack) { btnSubmit.Style.Add("display", "none"); btnUpdate.Style.Add("display", "none"); if (Session["User"] != null) { PageTitle.Text = "Update my account"; btnUpdate.Style.Add("display", ""); oUser = (PetStore.Class.User)Session["User"]; update = true; txtFirstname.Text = oUser.Address; oUser.City = txtLastName.Text = oUser.City; txtEmail.Text = oUser.Email; txtEmail.Enabled = false; txtFirstname.Text = oUser.FirstName; txtLastName.Text = oUser.LastName; txtPassword.Text = oUser.Password; txtAddress.Text = oUser.Address; txtCity.Text = oUser.City; //oUser.PetType = ddlPettype.SelectedItem.Value; txtPhone.Text = oUser.Phone; txtPostal.Text = oUser.PostalCode; txtProv.Text = oUser.Province; } else { PageTitle.Text = "Register"; btnSubmit.Style.Add("display", ""); DataTable dtPetType = new DataTable(); dtPetType = oDB.GetPetType(); //ddlPettype.DataSource = dtPetType; //ddlPettype.DataValueField = "PetType"; //ddlPettype.DataTextField = "Description"; //ddlPettype.DataBind(); //ddlPettype.Items.Insert(0, new ListItem("--Select your pet type--", "")); } } }