protected void Insert(object sender, EventArgs e)
        {
            lblMensaje.Text = "";
            if (txtBrand.Text != "" && txtCostUSD.Text != "" && txtModel.Text != "")
            {
                using (DroidikaContextDataContext ctx = new DroidikaContextDataContext())
                {
                    dCatDrone drone = new dCatDrone
                    {
                        brand      = txtBrand.Text,
                        model      = txtModel.Text,
                        costUsd    = decimal.Parse(txtCostUSD.Text),
                        flightTime = Int32.Parse(txtFlightTime.Text)
                    };
                    ctx.dCatDrones.InsertOnSubmit(drone);
                    ctx.SubmitChanges();
                }

                this.BindGrid();
            }
            else
            {
                lblMensaje.Text = "Favor de introducir los campos requeridos.";
            }
        }
        protected void OnRowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int idCatDrones = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0]);

            using (DroidikaContextDataContext ctx = new DroidikaContextDataContext())
            {
                dCatDrone drones = (from c in ctx.dCatDrones
                                    where c.id == idCatDrones
                                    select c).FirstOrDefault();
                ctx.dCatDrones.DeleteOnSubmit(drones);
                ctx.SubmitChanges();
            }
            this.BindGrid();
        }
        protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row         = GridView1.Rows[e.RowIndex];
            int         idCatDrones = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0]);
            string      brand       = (row.FindControl("txtBrand") as TextBox).Text;
            string      model       = (row.FindControl("txtModel") as TextBox).Text;
            string      costUsd     = (row.FindControl("txtCostUSD") as TextBox).Text;
            string      flightTime  = (row.FindControl("txtFlightTime") as TextBox).Text;

            using (DroidikaContextDataContext ctx = new DroidikaContextDataContext())
            {
                dCatDrone drone = (from c in ctx.dCatDrones
                                   where c.id == idCatDrones
                                   select c).FirstOrDefault();
                drone.brand      = brand;
                drone.model      = model;
                drone.costUsd    = decimal.Parse(costUsd);
                drone.flightTime = Int32.Parse(flightTime);
                ctx.SubmitChanges();
            }
            GridView1.EditIndex = -1;
            this.BindGrid();
        }