// NOT IN USE protected void OnItemCommand(object source, RepeaterCommandEventArgs e) { SPList movies = SPContext.Current.Web.Lists.TryGetList("Movies"); SPListItemCollection moviesCollection = movies.Items; int movieItemId = int.Parse(((LinkButton)e.Item.FindControl("RemoveButton")).CommandArgument); LinkButton click = (LinkButton)e.Item.FindControl("RemoveButton"); click.Attributes.Add("OnClick", "showDialog()"); if (e.CommandName == "delete") { moviesCollection.DeleteItemById(movieItemId); } //else if (e.CommandName == "edit") //{ // EditIndex = e.Item.ItemIndex; //} //else if (e.CommandName == "save") //{ // HtmlInputHidden t = e.Item.FindControl("firstNameHidden") as HtmlInputHidden; // Data.Contacts[e.Item.ItemIndex].FirstName = t.Value; // t = e.Item.FindControl("lastNameHidden") as HtmlInputHidden; // Data.Contacts[e.Item.ItemIndex].LastName = t.Value; // EditIndex = -1; //} RepeaterMovie.DataSource = moviesCollection; RepeaterMovie.DataBind(); }
public bool DeletaItens(SPListItemCollection Itens) { foreach (SPListItem i in Itens) { Itens.DeleteItemById(i.ID); } Itens.List.Update(); return(true); }
public void DeleteItemById(int id) { m_listItemCollection.DeleteItemById(id); }