Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         CertificateDropDownList.DataValueField = "Id";
         CertificateDropDownList.DataTextField  = "Name";
         CertificateDropDownList.DataSource     = CertificateService.LoadAllCertificates(SessionVariable.Current.Company.Id);
         CertificateDropDownList.DataBind();
         CertificateDropDownList.Items.Insert(0, new ListItem {
             Text = "Select a certificate", Value = "0"
         });
     }
 }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            courseId = Request.QueryString["csid"];

            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(courseId))
                {
                    var course = CourseService.GetCourseById(SessionVariable.Current.Company.Id, courseId);

                    if (course != null)
                    {
                        if (course.Sessions.SelectMany(x => x.Enrollments).Any())
                        {
                            DelBtn.Attributes.Add("disabled", "disabled");
                        }

                        NameTextBox.Text        = course.Name;
                        DescriptionTextBox.Text = course.Description;

                        CourseTypeRadioButtonList.SelectedValue     = ((int)course.CourseType).ToString();
                        CourseLocationRadioButtonList.SelectedValue = ((int)course.CourseLocation).ToString();
                        CourseAccessDropDownList.SelectedValue      = ((int)course.CourseAccess).ToString();
                        CourseTypeRadioButtonList.Enabled           = false;

                        CertificateDropDownList.DataValueField = "Id";
                        CertificateDropDownList.DataTextField  = "Name";
                        CertificateDropDownList.DataSource     = CertificateService.LoadAllCertificates(SessionVariable.Current.Company.Id);
                        CertificateDropDownList.DataBind();
                        CertificateDropDownList.Items.Insert(0, new ListItem {
                            Text = "Select a certificate", Value = "0"
                        });

                        if (course.CertificateId != null)
                        {
                            CertificateDropDownList.SelectedValue = course.CertificateId;
                        }
                    }
                }
            }
        }