1
How can I delete a specific line from a DataTable
and then reload a ViewState
with the rest of the lines that stayed? I have the following case below, but am not getting deleta directly from DataTable
.
protected void rdItens_DeleteCommand(object sender, GridCommandEventArgs e)
{
string ID = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString();
DataTable table = (DataTable)ViewState["ItensGrid"];
var linha = table.Rows.Find(ID);
linha.Delete();
ViewState["ItensGrid"] = table;
}
the [Indice] in this case is my ID?
– Marco Souza
Yeah, I put it as an index just to make it a little bit clearer.
– Marconi
Perfect, I just didn’t understand what the
AcceptChanges()
ago.– Marco Souza
Acceptchanges() accepts modifications.
– Marconi