コード例 #1
0
        /**
         * <summary>
         * This is the protected method GridViewDataBind to bind data with gridview
         * </summary>
         *
         * @method GridViewDataBind
         * @returns {void}
         */
        protected void GridViewDataBind()
        {
            // connect to EF DB
            using (TodoContext1 db = new TodoContext1())
            {
                string SortString = Session["SortColumn"].ToString() + " " +
                                    Session["SortDirection"].ToString();
                // query the Todos Table using EF and LINQ
                var todoList = (from todolist in db.Todos
                                select new
                {
                    TodoID = todolist.TodoID,
                    TodoDescription = todolist.TodoDescription,
                    TodoNotes = todolist.TodoNotes,
                    Completed = todolist.Completed
                }).ToList();



                // bind the result to the TodoListGridView
                TodoListGridView.DataSource = todoList.AsQueryable().OrderBy(SortString).ToList();
                TodoListGridView.DataBind();
                TodoListGridView.Columns[0].Visible = false;
            }
        }
コード例 #2
0
        /// <summary>
        /// This method gets the student data from the DB
        /// </summary>
        private void GetTodo()
        {
            // connect to EF DB
            using (TodoConnection db = new TodoConnection())
            {
                // query the Student Table using EF and LINQ
                var Todo = (from allTodo in db.ToDo select allTodo);

                // bind the result to the Students GridView
                TodoListGridView.DataSource = Todo.ToList();
                TodoListGridView.DataBind();
            }
        }
コード例 #3
0
            private void GetData()
            {
                //connect to DB
                using (TodoContext db = new ContosoContext())
                {
                    //querry the todoList table
                    var Data = (from alldata in db.Students select alldata);

                    //bind the result to the TodoList GridView
                    TodoListGridView.DataSource = TodoList.ToList();
                    TodoListGridView.DataBind();
                }
            }
コード例 #4
0
        /// <summary>
        /// This method gets the Todo data from the DB
        /// </summary>
        private void TodoData()
        {
            // connect to DB
            using (TodoContext db = new TodoContext())
            {
                // query the Todo Table using EF and LINQ
                var ToDo = (from allTodos in db.Todoes
                            select allTodos);

                // bind the result to the TodoList GridView
                TodoListGridView.DataSource = ToDo.ToList();
                TodoListGridView.DataBind();
            }
        }
コード例 #5
0
        /// <summary>
        /// This method gets the Todo data from the DB
        /// </summary>
        private void GetTodos()
        {
            // connect to EF DB
            using (TodoContext db = new TodoContext())
            {
                // query the Todo Table using EF and LINQ
                var Todos = (from allTodos in db.Todos
                             select allTodos);

                // bind the result to the Students GridView
                TodoListGridView.DataSource = Todos.ToList();
                TodoListGridView.DataBind();
            }
        }