protected void checkit_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "delteitem") { AllNewsTb delteTb = new AllNewsTb(); try { if (ModelState.IsValid) { string Txtid = ((Label)e.Item.FindControl("DeltText")).Text; using (var deleteContent = new Tafias_blogDb()) { var query = (from del in deleteContent.AllNewsTbs where (del.AllNewsTbID.Equals(Txtid)) select del).FirstOrDefault(); if (query != null) { deleteContent.Entry(query).State = System.Data.EntityState.Deleted; deleteContent.SaveChanges(); Response.Redirect("~/Admin/Posts.aspx?ID=" + "Deleted"); } } } } catch { } } }
private void next() { AllNewsTb altb = new AllNewsTb(); PagedDataSource pg = new PagedDataSource(); EntityDataSource dt = new EntityDataSource(); pg.AllowPaging = true; more.Enabled = !pg.IsFirstPage; }