// End declaration protected void Page_Load(object sender, EventArgs e) { // It does this only the first time the page is loaded if (!IsPostBack) { // Get user index and usert object for that index userIndex = Convert.ToInt32(Request.QueryString["userId"]); users = BUsers.getById(userIndex); // Save the user object in viewState ViewState["users"] = users; // Load the dropDownList DdlRegion.DataSource = BRegions.getAll(); DdlRegion.DataTextField = "Name"; DdlRegion.DataValueField = "RegionId"; DdlRegion.DataBind(); // DNI cannot be modified boxDNI.Enabled = false; boxDNI.Text = users.Dni.ToString(); // Set the value of the record DdlRegion.SelectedValue = users.RegionId.ToString(); boxName.Text = users.Name; boxLastName.Text = users.LastName; boxSignUp.Text = users.SignUpDate.ToString("dd/MM/yyyy"); boxRenewal.Text = users.RenewalDate.ToString("dd/MM/yyyy"); boxUserName.Text = users.UserName; boxPass.Text = users.Pass; } }
// End declaration protected void Page_Load(object sender, EventArgs e) { // It does this only the first time the page is loaded if (!IsPostBack) { // Get the record to update through the index in the url userIndex = Convert.ToInt32(Request.QueryString["userId"]); users = BUsers.getById(userIndex); // Sets people id in viewState ViewState["users"] = users; // Load the dropDownList DdlRegion.DataSource = BRegions.getAll(); DdlRegion.DataTextField = "Name"; DdlRegion.DataValueField = "RegionId"; DdlRegion.DataBind(); // Set the value of the record DdlRegion.SelectedValue = users.RegionId.ToString(); boxName.Text = users.Name; boxLastName.Text = users.LastName; boxDNI.Text = users.Dni.ToString(); boxSignUp.Text = users.SignUpDate.ToShortDateString(); boxRenewal.Text = users.RenewalDate.ToShortDateString(); boxUserName.Text = users.UserName; boxPass.Text = users.Pass; // Disable fields disableFields(); } }
protected void Page_Load(object sender, EventArgs e) { // It does this only the first time the page is loaded if (!IsPostBack) { // Load the dropDownList DdlRegion.DataSource = BRegions.getAll(); DdlRegion.DataTextField = "Name"; DdlRegion.DataValueField = "RegionId"; DdlRegion.DataBind(); // Shows sign up date and renewal date (just 6 months more) boxSignUp.Text = DateTime.Today.ToString("dd/MM/yyyy"); boxRenewal.Enabled = false; boxRenewal.Text = DateTime.Today.AddMonths(6).ToString("dd/MM/yyyy"); } }