private void loadLatest() { var resourcesList = _db.Resources.OrderByDescending(m => m.DateCreated).Take(1).ToList(); if (!resourcesList.Any()) { LstResources.DataSource = new List <Resource>(); LstResources.DataBind(); } LstResources.DataSource = resourcesList; LstResources.DataBind(); }
private void loadResources() { int resoucesId = int.Parse(Request.QueryString[0]); var resourcesList = _db.Resources.Where(m => m.SheetId == resoucesId).ToList(); if (!resourcesList.Any()) { LstResources.DataSource = new List <Resource>(); LstResources.DataBind(); } LstResources.DataSource = resourcesList; LstResources.DataBind(); }
private void loadResources() { //var resourceList = _db.Resources.ToList(); var resourceList = _db.Resources.OrderByDescending(s => s.DateCreated).ToList(); if (!resourceList.Any()) { LstResources.DataSource = new List <Resource>(); LstResources.DataBind(); } LstResources.DataSource = resourceList; LstResources.DataBind(); }
protected void btnSearch_Click(object sender, EventArgs e) { if (txtSearch.Value == "") { loadResources(); } else { var resourceList = _db.Resources.Where(m => m.Title == txtSearch.Value).ToList(); if (!resourceList.Any()) { LstResources.DataSource = new List <Resource>(); LstResources.DataBind(); } LstResources.DataSource = resourceList; LstResources.DataBind(); } }
private void loadResources() { //var resourceList = _db.Resources.ToList(); //var resourceList = _db.Resources.OrderByDescending(s => s.DateCreated).Take(6).ToList(); var resourceList = _db.Resources.Where(s => s.CategoryId == 1).ToList(); if (!resourceList.Any()) { LstResources.DataSource = new List <Resource>(); LstResources.DataBind(); } LstResources.DataSource = resourceList; LstResources.DataBind(); //SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=ReportSheet;Integrated Security=True"); //SqlDataAdapter sda = new SqlDataAdapter("select* from Resources", con); //DataTable dt = new DataTable(); //sda.Fill(dt); //ListView1.DataSource = dt; //ListView1.DataBind(); }