Example #1
0
        protected void StudentsGridView_BindGridView()
        {
            InstructorCourse course = GrouperMethods.GetInstructorCourse(InstructorCourseID);

            StudentsGridView.DataSource = course.Students;
            StudentsGridView.DataBind();
        }
Example #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         StudentsGridView.Sort("LastName", SortDirection.Ascending);
     }
 }
Example #3
0
        protected void StudentsGridView_BindGridView()
        {
            InstructorCourse course = GrouperMethods.GetInstructorCourse(InstructorCourseID);

            if (course.Groups.Count > 0)
            {
                NumberOfGroupsDropDownList.SelectedValue = course.Groups.Count.ToString();
            }

            StudentsGridView.DataSource = course.Students;
            StudentsGridView.DataBind();
        }
Example #4
0
        /**
         * <summary>
         * This method gets the student data from the DB
         * </summary>
         *
         * @method GetStudents
         * @returns {void}
         */

        protected void GetStudents()
        {
            //connect to EF
            using (DefaultConnection db = new DefaultConnection())
            {
                //query the students table using EF and LINQ
                var Students = (from allStudents in db.Students
                                select allStudents);
                //bind the results to the gridview
                StudentsGridView.DataSource = Students.ToList();
                StudentsGridView.DataBind();
            }
        }
Example #5
0
        /// <summary>
        /// This method gets the student data from db
        /// </summary>

        private void GetStudents()
        {
            //connect to EF DB
            using (ContosoContext db = new ContosoContext())
            {
                //query the student table using EF and LINQ
                var Students = (from allStudents in db.Students
                                select allStudents);

                //bind the result to the Students GridView
                StudentsGridView.DataSource = Students.ToList();
                StudentsGridView.DataBind();
            }
        }
        /**
         * <summary>
         * This method gets the student data from the database
         * </summary>
         * @method GetStudents
         * @return {void}
         * */
        protected void GetStudents()
        {
            //connect to EF
            using (ContosoConnection db = new ContosoConnection())
            {
                string SortString = Session["SortColumn"].ToString() + " " + Session["SortDirection"].ToString();
                //query the students table using EF and LINQ
                var Students = (from allStudents in db.Students select allStudents);

                //bind results to gridview
                StudentsGridView.DataSource = Students.AsQueryable().OrderBy(SortString).ToList();
                StudentsGridView.DataBind();
            }
        }
Example #7
0
        /**
         * <summary>
         * This method gets the student data from the DB
         * </summary>
         *
         * @method GetStudents
         * @returns {void}
         */
        protected void GetStudents()
        {
            // connect to EF
            using (DefaultConn db = new DefaultConn()) {
                //create query string
                string SortString = Session["SortColumn"].ToString() + " " + Session["SortDirection"].ToString();
                // query the Students Table using EF and LINQ
                var Students = (from allStudents in db.Students
                                select new { allStudents.StudentID, allStudents.LastName, allStudents.FirstMidName, allStudents.EnrollmentDate });

                // bind the result to the GridView
                StudentsGridView.DataSource = Students.AsQueryable().OrderBy(SortString).ToList();
                StudentsGridView.DataBind();
            }
        }
Example #8
0
        /**
         * <summary>
         * This method gets the student data from the DB
         * </summary>
         *
         * @method GetStudents
         * @returns {void}
         */

        protected void GetStudents()
        {
            // Connect to EF
            using (DefaultConnection db = new DefaultConnection())
            {
                string SortString = Session["SortColumn"].ToString() + " " + Session["SortDirection"].ToString();

                // Query the Students Table using EF and LINQ
                var Students = (from allStudents in db.Students
                                select allStudents);

                // Bind the result to the GridView
                StudentsGridView.DataSource = Students.AsQueryable().OrderBy(SortString).ToList();
                StudentsGridView.DataBind();
            }
        }
        /// <summary>
        /// This is a method to get the student's data from the DataBase
        /// </summary>
        private void BindList()
        {
            string        connectionString = ConfigurationManager.ConnectionStrings["Assginment_03"].ConnectionString;
            SqlConnection conn             = new SqlConnection(connectionString);
            SqlCommand    comm             = new SqlCommand("select * from Students", conn);

            try
            {
                conn.Open();
                SqlDataReader reader = comm.ExecuteReader();
                StudentsGridView.DataSource = reader;
                StudentsGridView.DataBind();
                reader.Close();
            }
            finally
            {
                conn.Close();
            }
        }
Example #10
0
        protected void AddStudentBTN_Click(object sender, EventArgs e)
        {
            MembershipCreateStatus createStatus;
            MembershipUser         newUser = Membership.CreateUser(st_UsernameTB.Text, st_PasswordTB.Text, st_EmailTB.Text, "Default Question", "Default Answer", true, out createStatus);

            switch (createStatus)
            {
            case MembershipCreateStatus.Success:
                AddStudentResultLB.Text = "<i class='icon-ok'></i>  The student account was successfully created!";
                break;

            case MembershipCreateStatus.DuplicateUserName:
                AddStudentResultLB.Text = "<i class='icon-remove'></i>  There already exists a student with this username.";
                break;

            case MembershipCreateStatus.DuplicateEmail:
                AddStudentResultLB.Text = "<i class='icon-remove'></i>  There already exists a student with this email address.";
                break;

            case MembershipCreateStatus.InvalidEmail:
                AddStudentResultLB.Text = "<i class='icon-remove'></i>  The email address you provided in invalid.";
                break;

            case MembershipCreateStatus.InvalidAnswer:
                AddStudentResultLB.Text = "<i class='icon-remove'></i>  The security answer was invalid.";
                break;

            case MembershipCreateStatus.InvalidPassword:
                AddStudentResultLB.Text = "<i class='icon-remove'></i>  The password you provided is invalid. It must be seven characters long and have at least one non-alphanumeric character.";
                break;

            default:
                AddStudentResultLB.Text = "<i class='icon-remove'></i>  There was an unknown error; the user account was NOT created.";
                break;
            }
            if (createStatus == MembershipCreateStatus.Success)
            {
                StudentsDS.Insert();
                StudentsGridView.DataBind();
            }
        }
 protected void Page_Init(object sender, EventArgs e)
 {
     StudentsGridView.EnableDynamicData(typeof(Student));
     SearchGridView.EnableDynamicData(typeof(Student));
 }