protected void Calendar1_SelectionChanged(object sender, EventArgs e) { BorrowRepository br = new BorrowRepository(); List <MRSLibrary.Database.BorrowTable> lst = new List <MRSLibrary.Database.BorrowTable>(); int val = Convert.ToInt16(DropDownList1.SelectedValue); lst = br.GetBorrowForDate(val, Calendar1.SelectedDate); if (lst == null) { Label4.Visible = true; GridView1.Visible = false; } else { Label4.Visible = false; GridView1.DataSource = lst; GridView1.DataBind(); } }