Example #1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     Core.Entity.Customer customer = new Core.Entity.Customer();
     customer.FirstName    = txtFirstName.Text;
     customer.LastName     = txtLastName.Text;
     customer.MobileNumber = txtMobileNumber.Text;
     customer.EmailId      = txtEmailId.Text;
     customerManager.Add(customer);
     BindCustomerGrid();
     ResetControls();
 }
Example #2
0
        protected void grvCustomer_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            int         CustomerId = Convert.ToInt32(grvCustomer.DataKeys[e.RowIndex].Value.ToString());
            GridViewRow row        = (GridViewRow)grvCustomer.Rows[e.RowIndex];

            TextBox textFirstName    = (TextBox)row.Cells[1].Controls[0];
            TextBox textLastName     = (TextBox)row.Cells[2].Controls[0];
            TextBox textMobileNumber = (TextBox)row.Cells[3].Controls[0];
            TextBox textEmailId      = (TextBox)row.Cells[4].Controls[0];


            Core.Entity.Customer customer = new Core.Entity.Customer();
            customer.CustomerId   = CustomerId;
            customer.FirstName    = textFirstName.Text;
            customer.LastName     = textLastName.Text;
            customer.MobileNumber = textMobileNumber.Text;
            customer.EmailId      = textEmailId.Text;


            customerManager.Update(customer);

            grvCustomer.EditIndex = -1;
            BindCustomerGrid();
        }