protected void gvPOItems_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int specialStationeryID = (int)DataBinder.Eval(e.Row.DataItem, "SpecialStationeryID"); if (specialStationeryID != 0) { TextBox tb = e.Row.FindControl("txtOrderQuantity") as TextBox; Literal requestedQuantity = e.Row.FindControl("ltlQuantity") as Literal; using (PurchaseOrderManager pom = new PurchaseOrderManager()) { requestedQuantity.Text = pom.GetQuantityToOrderSpecial(specialStationeryID).ToString(); tb.Text = requestedQuantity.Text; } } } }