protected void gvCustomerAddress_RowUpdating(object sender, GridViewUpdateEventArgs e) { this.ADDR_PKID = int.Parse(gvCustomerAddress.DataKeys[e.RowIndex].Values[0].ToString()); TextBox _txtCode = (TextBox)gvCustomerAddress.Rows[e.RowIndex].FindControl("txtCode"); TextBox _txtAddress = (TextBox)gvCustomerAddress.Rows[e.RowIndex].FindControl("txtAddress"); TextBox _txtTelephone = (TextBox)gvCustomerAddress.Rows[e.RowIndex].FindControl("txtTelephone"); TextBox _txtFax = (TextBox)gvCustomerAddress.Rows[e.RowIndex].FindControl("txtFax"); m_customer_address address = ListCustomerAddress.Find(x => x.ID == this.ADDR_PKID); if (address != null) { address.company_id = objCustomer.ID; address.code = _txtCode.Text; address.address = _txtAddress.Text; address.telephone = _txtTelephone.Text; address.fax = _txtFax.Text; } gvCustomerAddress.EditIndex = -1; gvCustomerAddress.DataSource = ListCustomerAddressShow; gvCustomerAddress.DataBind(); btnAdd.Enabled = true; }
protected void gvCustomerAddress_RowDeleting(object sender, GridViewDeleteEventArgs e) { this.ADDR_PKID = int.Parse(gvCustomerAddress.DataKeys[e.RowIndex].Values[0].ToString()); m_customer_address js = ListCustomerAddress.Find(x => x.ID == this.ADDR_PKID); if (js != null) { js.RowState = CommandNameEnum.Delete; gvCustomerAddress.DataSource = ListCustomerAddressShow; gvCustomerAddress.DataBind(); } btnAddCustomerAddress.Enabled = true; }