Source

UserControl / UserControl / update.aspx.cs

Full commit
using System;
using System.Web;

namespace UserControl
{
    public partial class update : System.Web.UI.Page
    {
        private static string MainPageUrl = "view.aspx";

        private void ShowError(string message)
        {
            LabelError.Text = HttpUtility.HtmlEncode(message);
            LabelError.Visible = true;
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (new Login(Session).LoginID == null) Response.Redirect(Login.LoginUrl);

            if (!IsPostBack)
            {
                string userID = HttpUtility.UrlDecode(Request.QueryString["id"]);
                if (userID == null) Response.Redirect(MainPageUrl);
                User user = new Users().FindUserByID(userID);
                if (user == null) Response.Redirect(MainPageUrl);
                LabelUserID.Text = HttpUtility.HtmlEncode(userID);
                TextBoxName.Text = user.Name;
                TextBoxPass.Text = user.Pass;
                TextBoxAge.Text = user.Age.ToString();
            }
        }

        protected void ButtonUserForm_Click(object sender, EventArgs e)
        {
            uint age;
            if (!uint.TryParse(TextBoxAge.Text, out age)) age = 0;
            User user;
            try
            {
                user = new User(Request.QueryString["id"],
                    TextBoxName.Text,
                    TextBoxPass.Text,
                    age);
            }
            catch (FormatException err)
            {
                ShowError(err.Message);
                return;
            }
            Session["TargetUser"] = user;
            Response.Redirect("confirm.aspx");
        }
    }
}