protected void grdAgency_ItemCommand(object sender, GridCommandEventArgs e) { CreditAgencyBL bll = new CreditAgencyBL(); if (e.CommandName == "RemoveA") { int id = Convert.ToInt32(e.CommandArgument); bll.Delete(id); BindCreditRatings(); LogActivity("Agency Removed", "Currency has been removed", string.Empty); } else if (e.CommandName == "EditA") { int id = Convert.ToInt32(e.CommandArgument); CreditAgency model = bll.GetByID(id); txtCreditAgency.Text = model.CreditAgency1; hdnCreditAgency.Value = model.ID.ToString(); } BindCreditAgencies(); }
protected void grdCreditRatings_ItemDataBound(object sender, GridItemEventArgs e) { if ((e.Item is GridDataItem)) { int id = ((DAL.CreditRating)((e.Item).DataItem)).CreditAgencyID.Value; CreditAgencyBL agencyBL = new CreditAgencyBL(); Label lbl = (Label)e.Item.FindControl("lblAgencyName"); lbl.Text = agencyBL.GetByID(id).CreditAgency1; } }