protected void Page_Load(object sender, EventArgs e) { var repository = TaskRepository.Instance; GridViewTasks.DataSource = repository.GetCompletedTasks().Where(task => task.UserName == User.Identity.Name); GridViewTasks.DataBind(); }
protected void DropDownListCategories_SelectedIndexChanged(object sender, EventArgs e) { var repository = TaskRepository.Instance; GridViewTasks.DataSource = repository.GetTasksByCategory(DropDownListCategories.SelectedValue); GridViewTasks.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { var repository = TaskRepository.Instance; GridViewTasks.DataSource = repository.GetPendingTasks(); GridViewTasks.DataBind(); }
private void GetData() { using (SqlConnection con = new SqlConnection(conString)) { SqlCommand cmd = new SqlCommand("Select * from tbltaskdata where username='******'", con); con.Open(); GridViewTasks.DataSource = cmd.ExecuteReader(); GridViewTasks.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var repository = TaskRepository.Instance; DropDownListCategories.DataSource = repository.GetCategories(); DropDownListCategories.DataValueField = "Value"; DropDownListCategories.DataBind(); GridViewTasks.DataSource = repository.GetTasksByCategory(DropDownListCategories.SelectedValue); GridViewTasks.DataBind(); } }
private void GetCategoryData() { using (SqlConnection con = new SqlConnection(conString)) { SqlCommand cmd = new SqlCommand("Select * from tbltaskdata where Category='" + DropDownList1.SelectedValue + "' AND username='******' ", con); con.Open(); SqlDataAdapter sda = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); sda.Fill(dt); GridViewTasks.DataSource = dt; GridViewTasks.DataBind(); } }