/// <summary> /// RowEditing is handled to retain status of selected checkbox after entering to edit mode. /// </summary> protected void OrderDetailsGridView_RowEditing(object sender, GridViewEditEventArgs e) { UpdateRowIfInEditMode(); GridViewRow row = OrderDetailsGridView.Rows[e.NewEditIndex]; CheckBox selectedCheckBox = (CheckBox)row.FindControl("SelectedCheckBox"); if (selectedCheckBox != null) { _presenter.OnEditOrderItemLine(row.DataItemIndex, selectedCheckBox.Checked); } OrderDetailsGridView.EditIndex = e.NewEditIndex; }
public void ShouldMaintainSelectedValueWhenEditingOrderLine() { view.OrderItemsLines = new List <OrderItemLine>(); OrderItemLine line1 = new OrderItemLine(1, "1234-56789", "#2 Pencil Pack", 1.99m, 10, 19.9m, false); OrderItemLine line2 = new OrderItemLine(2, "9876-54321", "Stencil Pad", .79m, 10, 7.9m, false); view.OrderItemsLines.Add(line1); view.OrderItemsLines.Add(line2); bool selectedValue = true; int rowIndex = 1; presenter.OnEditOrderItemLine(rowIndex, selectedValue); Assert.IsTrue(view.OrderItemsLinesRequested); Assert.IsTrue(view.OrderItemsLinesShown); Assert.AreEqual(selectedValue, view.OrderItemsLines[rowIndex].Selected); }