//Get the list from table protected void getList() { using (TodoContext db = new TodoContext()) { var item = (from s in db.Todos select s).ToList(); TodoGridView.DataSource = item; TodoGridView.DataBind(); } }
/** * <summary> * Gets data from database * </summary> * @method GetTodos * @returns {void} */ protected void GetTodos() { //connect to db using (TodoConnection db = new TodoConnection()) { //load from db var Todos = (from allTodos in db.Todos select allTodos); //update grid TodoGridView.DataSource = Todos.AsQueryable().ToList(); TodoGridView.DataBind(); } }
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 Todos GridView TodoGridView.DataSource = Todos.ToList(); TodoGridView.DataBind(); } }
/** * <summary> * This method gets the Todo data from the database * </summary> * @method GetTodos * @return {void} * */ protected void GetTodos() { // Connect to EF using (TodoConnection db = new TodoConnection()) { string SortString = Session["SortColumn"].ToString() + " " + Session["SortDirection"].ToString(); // Query the Todo table using EF and LINQ var Todos = (from allTodos in db.Todos select allTodos); // Bind results to gridview TodoGridView.DataSource = Todos.AsQueryable().OrderBy(SortString).ToList(); TodoGridView.DataBind(); } }
/* * <summary> * Grabs the todo from database and puts into a gridview * </summary> * @method GetTodo * @return {void} */ protected void GetTodo() { // connect to EF //connect to EF using (TodoConnection db = new TodoConnection()) { //query the Games table using EF and LINQ var Todo = (from allTodo in db.Todos select allTodo); //bind results to gridview TodoGridView.DataSource = Todo.AsQueryable().ToList(); TodoGridView.DataBind(); } }
private void GetTodos() { using (TodoContext db = new TodoContext()) { string SortString = Session["SortColumn"].ToString() + " " + Session["SortDirection"].ToString(); var Todos = (from allTodos in db.Todos select allTodos); TodoGridView.DataSource = Todos.AsQueryable().OrderBy(SortString).ToList(); TodoGridView.DataBind(); } }
protected void GetTodo() { string sortString = Session["SortColumn"].ToString() + " " + Session["SortDirection"].ToString(); // connect to EF using (TodoConnection db = new TodoConnection()) { // query the Students Table using EF and LINQ var g1 = (from allTodos in db.Todos select allTodos); // bind the result to the GridView TodoGridView.DataSource = g1.AsQueryable().OrderBy(sortString).ToList(); TodoGridView.DataBind(); } }
protected void GetToDo() { //Connect to Entity Framework using (TodoConnection db = new TodoConnection()) { string SortString = Session["SortColumn"].ToString() + " " + Session["SortDirection"].ToString(); //Query the Students Table using Entity Framework and LINQ var toDo = (from allToDo in db.Todos select allToDo); //Bind the results to the GridView TodoGridView.DataSource = toDo.ToList(); TodoGridView.DataBind(); } }
private void GetTodo() { using (TodoContext db = new TodoContext()) { string SortString = Session["SortColumn"].ToString() + " " + Session["SortDirection"].ToString(); // query todo table using EF and LINQ var todos = (from todo in db.Todos select todo); // bind the result to the todo GridView TodoGridView.DataSource = todos.AsQueryable().OrderBy(SortString).ToList(); TodoGridView.DataBind(); } }
/** * <summary> * This method gets the Todo list data from the DB * </summary> * * @method GetTodoList * @returns {void} */ protected void GetTodoList() { string sortString = Session["SortColumn"].ToString() + " " + Session["SortDirection"].ToString(); // connect to EF using (TodoConnection db = new TodoConnection()) { // query the Todo Table using EF and LINQ var TodoLists = (from alllist in db.Todos select alllist); // bind the result to the GridView TodoGridView.DataSource = TodoLists.AsQueryable().OrderBy(sortString).ToList(); TodoGridView.DataBind(); CheckBox cb = new CheckBox(); } }
//GetTodo method protected void GetTodo() { //using the TodoContext using (TodoContext db = new TodoContext()) { string SortString = Session["SortColumn"].ToString() + " " + Session["SortDirection"].ToString(); // query the Student Table using EF and LINQ var todo = (from allTodo in db.Todos select allTodo); // bind the result to the Students GridView TodoGridView.DataSource = todo.AsQueryable().OrderBy(SortString).ToList(); TodoGridView.DataBind(); } }
/// Get all the Tasks from the Todo List Table private void GetTodoList() { // connect to EF DB using (TodoContext db = new TodoContext()) { string SortString = Session["SortColumn"].ToString() + " " + Session["SortDirection"].ToString(); List <ToDoTable> tasklist = new List <ToDoTable>(); // Store the todo list tables in a variable var tasks = (from alltasks in db.ToDoTables select alltasks); // Bind result to the grid view tasklist.AddRange(tasks); TodoGridView.DataSource = tasks.AsQueryable().OrderBy(SortString).ToList(); TodoGridView.DataBind(); } }