예제 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         var instructorID = Request.QueryString["ID"];
         InstructorService instructorService = new InstructorService();
         var instructor = instructorService.GetOneInstructor(Convert.ToInt32(instructorID));
         InstructorIDLabel.Text = instructor.ID.ToString();
         HireDateLabel.Text     = instructor.HireDate.ToString();
     }
 }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var instructorID = Request.QueryString["ID"];

            if (!IsPostBack && instructorID == null)
            {
                ddlID.DataSource     = Utility.Utility.GetAllPeople();
                ddlID.DataTextField  = "ID";
                ddlID.DataValueField = "ID";
                ddlID.DataBind();
            }
            if (!IsPostBack && instructorID != null)
            {
                ddlID.DataSource     = Utility.Utility.GetAllPeople();
                ddlID.DataTextField  = "ID";
                ddlID.DataValueField = "ID";
                ddlID.DataBind();
                InstructorService         instructorService = new InstructorService();
                Contoso.Models.Instructor instructor        = instructorService.GetOneInstructor(Convert.ToInt32(instructorID));
                ddlID.SelectedValue = instructor.ID.ToString();
                txtHireDate.Text    = instructor.HireDate.ToString();
            }
        }