예제 #1
0
        private void BindData()
        {
            TraineeBLL trainee = new TraineeBLL(connectionString);

            TraineeList.DataSource = trainee.GetAllTrainees();
            TraineeList.DataBind();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         // retrieve data from database and populate it into the drodown list
         List <TraineeViewModel> trainees = tbll.GetAllTrainees();
         TraineeList.DataSource     = trainees;
         TraineeList.DataTextField  = "FirstName";
         TraineeList.DataValueField = "TraineeID";
         TraineeList.DataBind();
         TraineeList.Items.Insert(0, "--Select a trainee from the list--");
     }
 }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ScheduleBLL scbll = new ScheduleBLL();
                Schedule    sc    = scbll.GetScheduleById(Convert.ToInt32(Request.QueryString["ScheduleID"]));

                // Loading the dropdownlist
                List <TraineeViewModel> trainees = tbll.GetAllTrainees();
                TraineeList.DataSource     = trainees;
                TraineeList.DataTextField  = "FirstName";
                TraineeList.DataValueField = "TraineeID";
                TraineeList.DataBind();
                TraineeList.Items.Insert(0, "--Select a trainee from the list--");
                TraineeList.SelectedValue = sc.TraineeID.ToString();
                DateOfAppointment.Text    = sc.ScheduleDtTime.ToString("yyyy-MM-dd"); //The format has to be like this: "yyyy-mm-dd" otherwise it won't show in the browser
                //DateOfAppointment.Text = sc.DisplayScheduleDtTime.ToString();
                TimeOfAppointment.Text = sc.InputDtTime.ToString("HH:mm");
            }
        }