protected void gvDetails_RowUpdating(object sender, GridViewUpdateEventArgs e) { Agent adAgentDom = new Agent(); int AgentId = Convert.ToInt32(gvDetails.DataKeys[e.RowIndex].Value.ToString()); string AgentName = gvDetails.DataKeys[e.RowIndex].Values["AgentName"].ToString(); TextBox txtusername = (TextBox)gvDetails.Rows[e.RowIndex].FindControl("txtusername"); TextBox txtpass = (TextBox)gvDetails.Rows[e.RowIndex].FindControl("txtpass"); TextBox txtcper = (TextBox)gvDetails.Rows[e.RowIndex].FindControl("txtcper"); TextBox txtname = (TextBox)gvDetails.Rows[e.RowIndex].FindControl("txtname"); TextBox txtadd = (TextBox)gvDetails.Rows[e.RowIndex].FindControl("txtadd"); TextBox txtcity = (TextBox)gvDetails.Rows[e.RowIndex].FindControl("txtcity"); TextBox txtpin = (TextBox)gvDetails.Rows[e.RowIndex].FindControl("txtpin"); TextBox txtemail = (TextBox)gvDetails.Rows[e.RowIndex].FindControl("txtemail"); TextBox txtphone = (TextBox)gvDetails.Rows[e.RowIndex].FindControl("txtphone"); TextBox txtfax = (TextBox)gvDetails.Rows[e.RowIndex].FindControl("txtfax"); TextBox txtenable = (TextBox)gvDetails.Rows[e.RowIndex].FindControl("txtenable"); TextBox txtpro = (TextBox)gvDetails.Rows[e.RowIndex].FindControl("txtpro"); TextBox txtscharge = (TextBox)gvDetails.Rows[e.RowIndex].FindControl("txtscharge"); TextBox txtccharge = (TextBox)gvDetails.Rows[e.RowIndex].FindControl("txtccharge"); TextBox txttally = (TextBox)gvDetails.Rows[e.RowIndex].FindControl("txttally"); TextBox txtdcharge = (TextBox)gvDetails.Rows[e.RowIndex].FindControl("txtdcharge"); TextBox txtopening = (TextBox)gvDetails.Rows[e.RowIndex].FindControl("txtopening"); //adAgentDom.AgentUserName = txtusername.Text; //adAgentDom.AgentPassword = txtpass.Text; adAgentDom.AgentCPerson = txtcper.Text; adAgentDom.AgentName = txtname.Text; adAgentDom.AgentAddress = txtadd.Text; adAgentDom.AgentCity = txtcity.Text; adAgentDom.AgentPin = txtpin.Text; adAgentDom.AgentEmail = txtemail.Text; adAgentDom.AgentPhone = txtphone.Text; adAgentDom.AgentFax = txtfax.Text; adAgentDom.AgentEnable = txtenable.Text; adAgentDom.AgentPrority = Convert.ToInt32(txtpro.Text); adAgentDom.AgentSCharge = Convert.ToDecimal(txtscharge.Text); adAgentDom.AgentCCharge = Convert.ToDecimal(txtccharge.Text); adAgentDom.TallyAcName = txttally.Text; adAgentDom.AgentDDCharge = Convert.ToDecimal(txtdcharge.Text); adAgentDom.OpeningBalance = Convert.ToDecimal(txtopening.Text); adAgentBal.updaterecord(AgentId, adAgentDom); Response.Write("<script LANGUAGE='JavaScript' >alert('Agent Details Updated successfully')</script>"); //lblresult.Text = AgentName + " Details Updated successfully"; gvDetails.EditIndex = -1; BindAgentDetails(); }