// Retrieve the name of the item to remove. String item = ((Label)e.Item.FindControl("ItemLabel")).Text; // Filter the CartView for the selected item and remove it from // the data source. dView.RowFilter = "Item='" + item + "'"; if (dView.Count > 0) { dView.Delete(0); } dView.RowFilter = "";可以通过dView来获得你需要的ID值。 dView是你的DataList绑定的DataTable的DataView
String item = ((Label)e.Item.FindControl("ItemLabel")).Text; // Filter the CartView for the selected item and remove it from
// the data source.
dView.RowFilter = "Item='" + item + "'";
if (dView.Count > 0)
{
dView.Delete(0);
}
dView.RowFilter = "";可以通过dView来获得你需要的ID值。 dView是你的DataList绑定的DataTable的DataView
((Label)e.Item.FindControl("ItemLabel")).Text;只在编辑的状态下可用!不可以实现!