protected void OnRowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow && ((InventoryRetrievalList)e.Row.DataItem).ItemID != null) { InventoryRetrievalList iRL = (InventoryRetrievalList)e.Row.DataItem; string itemId = iRL.ItemID; string itemName = InventoryLogic.GetItemName(itemId); string uom = InventoryLogic.GetInventoryItem(itemId).UOM; Label LblDesc = (e.Row.FindControl("LblDesc") as Label); if (LblDesc != null) { LblDesc.Text = itemName; } Label LblUom = (e.Row.FindControl("LblUom") as Label); if (LblUom != null) { LblUom.Text = uom; } } }
protected void RowDeleting(object sender, GridViewDeleteEventArgs e) { Label LblSn = GridViewDisbList.Rows[e.RowIndex].Cells[0].FindControl("LblSn") as Label; int sN = int.Parse(LblSn.Text); List <InventoryRetrievalList> iRList = new List <InventoryRetrievalList>(); foreach (GridViewRow r in GridViewDisbList.Rows) { TextBox remarks = r.FindControl("TxtRemarks") as TextBox; InventoryRetrievalList iR = new InventoryRetrievalList(); iR.RetrievalID = int.Parse((r.FindControl("HideRetriId") as HiddenField).Value); iR.ItemID = (r.FindControl("LblItemCode") as Label).Text; iR.RequestedQuantity = int.Parse((r.FindControl("LblReqQty") as Label).Text); iR.ActualQuantity = int.Parse((r.FindControl("LblActulQty") as Label).Text); remarks.Text = (r.FindControl("TxtRemarks") as TextBox).Text; iRList.Add(iR); } iRList.RemoveAt(sN - 1); GridViewDisbList.DataSource = iRList; GridViewDisbList.DataBind(); }