protected void GatewayGrid_RowDeleting(object sender, GridViewDeleteEventArgs e) { int gatewayId = (int)GatewayGrid.DataKeys[e.RowIndex].Value; //FIND THE OPTION IList <PaymentGateway> gateways = LoadGateways(); int index = -1; int i = 0; while ((i < gateways.Count) && (index < 0)) { if (gateways[i].Id == gatewayId) { index = i; } i++; } if (index >= 0) { gateways.DeleteAt(index); GatewayGrid.DataSource = gateways; GatewayGrid.DataBind(); } }
protected void Page_Init(object sender, EventArgs e) { GatewayGrid.DataSource = LoadGateways(); GatewayGrid.DataBind(); }