protected void btnSaveToDB_Click(object sender, EventArgs e) { AgentBiz biz = new AgentBiz(); // check change list foreach (GridViewRow row in lstCompany.Rows) { Label lbID = row.FindControl("lbAgentID") as Label; TextBox txtDiscount = row.FindControl("txtDiscount") as TextBox; HiddenField hdDiscount = row.FindControl("hdDiscount") as HiddenField; TextBox txtCredit = row.FindControl("txtCredit") as TextBox; HiddenField hdCredit = row.FindControl("hdCredit") as HiddenField; decimal newDiscount = PageTools.ParseDecimal(txtDiscount.Text); decimal oldDiscount = PageTools.ParseDecimal(hdDiscount.Value); int agentID = PageTools.ParseInt(lbID.Text); if (newDiscount != oldDiscount) { biz.SaveAgentDiscount(agentID, newDiscount); } decimal newCredit = PageTools.ParseDecimal(txtCredit.Text); decimal oldCredit = PageTools.ParseDecimal(hdCredit.Value); if (newCredit != oldCredit) { biz.SaveAgentCredit(agentID, newCredit); } } lstCompany.DataBind(); btnSave.Visible = true; pnResult.Visible = false; lstCompany.Visible = true; }