예제 #1
0
        private void executeDelete(string code)
        {
            if (IsValid)
            {
                var parameters = SqlDataSource1.DeleteParameters;
                parameters["MaLop"].DefaultValue = code;

                try
                {
                    SqlDataSource1.Delete();
                }
                catch (Exception)
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Vui lòng kiểm tra lại.');", true);
                }
            }
        }
예제 #2
0
 protected void GridView2_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     //string strOrderID = ((Label)gvTemp.Rows[e.RowIndex].FindControl("lblOrderID")).Text;
     try
     {
         GridView gvTemp = (GridView)sender;
         gvUniqueID = gvTemp.UniqueID;
         string             ofpid = ((Label)gvTemp.Rows[e.RowIndex].FindControl("lborderProductID")).Text;
         Order_Form_Product OFP   = db.Order_Form_Product.First(p => p.orderformproduct_id.ToString() == ofpid);
         db.Order_Form_Product.DeleteOnSubmit(OFP);
         db.SubmitChanges();
         SqlDataSource1.DeleteCommand = " ";
         SqlDataSource1.Delete();
         GridView1.DataBind();
     }
     catch { }
 }
예제 #3
0
        protected void ButtonОк1_Click(object sender, EventArgs e)
        {
            // Удаление файла, записи в БД и физически

            //Находим физический путь файла

            string appPath = Request.PhysicalApplicationPath;

            SqlConnection connection = new SqlConnection(SqlDataSource1.ConnectionString);

            SqlCommand getFile = new SqlCommand(
                "SELECT Путь FROM TeorFiles " +
                "WHERE (TeorFileId LIKE  '" + GridView1.SelectedValue + "');", connection);

            connection.Open();

            SqlDataReader reader = getFile.ExecuteReader();

            try
            {
                reader.Read();
                File.Delete(appPath + reader[0].ToString());
            }
            catch
            {
            }
            finally
            {
                reader.Close();
                connection.Close();
            }



            // Удаление записи из БД
            SqlDataSource1.DeleteCommand = @"DELETE FROM TeorFiles WHERE (TeorFileId LIKE  '" + GridView1.SelectedValue + "')";

            SqlDataSource1.Delete();



            GridView1.SelectRow(-1);

            Panel1.Visible    = false;
            GridView1.Enabled = true;
        }
예제 #4
0
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            GridViewRow rr = GridView1.Rows[i];

            if (((CheckBox)rr.FindControl("CheckBox1")).Checked)
            {
                string trans_id = rr.Cells[1].Text.Trim();
                SqlDataSource1.DeleteParameters["Original_dep_id"].DefaultValue = trans_id;
                SqlDataSource1.Delete();
            }
            else
            {
            }
        }
    }
 protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
 {
     if (e.CommandName == "Sua")
     {
         Label lb = (Label)e.Item.FindControl("TitleLabel");
         Session["Newsid"] = lb.Text;
     }
     //else
     if (e.CommandName == "Xoa")
     {
         SqlDataSource1.DeleteParameters.Clear();
         Label lb = (Label)e.Item.FindControl("NewsIDLabel");
         SqlDataSource1.DeleteParameters.Add("NewsID", TypeCode.Int32, lb.Text);
         SqlDataSource1.Delete();
         SqlDataSource1.DataBind();
         DataList1.DataBind();
     }
 }
예제 #6
0
 protected void lbDelete_Click(object sender, EventArgs e)
 {
     for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
     {
         CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("chkSelectRow");
         if (cbox.Checked)
         {
             try
             {
                 SqlDataSource1.DeleteParameters["Stu_ID"].DefaultValue = ((Label)GridView1.Rows[i].FindControl("txtStu_ID")).Text;
                 SqlDataSource1.Delete();
             }
             catch (SqlException)
             {
                 lblTooltip.Text = string.Format("无法删除学号为‘{0}'的学生信息!", ((Label)GridView1.Rows[i].FindControl("txtStu_ID")).Text);
             }
         }
     }
 }
    protected void delete_Click(object sender, EventArgs e)
    {
        sfactor.Text = "";
        DataView dv =
            (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);

        if (dv.Count == 0)
        {
            comment1.Text = "Error: No items to delete!";
        }
        else
        {
            comment1.Text = "Successfully deleted 1 item!";
            if (output3.SelectedItem != null)
            {
                SqlDataSource1.Delete();
            }
        }
    }
예제 #8
0
 protected void lbDelete_Click(object sender, EventArgs e)
 {
     for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
     {
         CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("chkSelectRow");
         if (cbox.Checked)
         {
             try
             {
                 SqlDataSource1.DeleteParameters["Account"].DefaultValue = ((Label)GridView1.Rows[i].FindControl("txtAccount")).Text;
                 SqlDataSource1.Delete();
             }
             catch (SqlException)
             {
                 lblTooltip.Text = "删除失败!";
             }
         }
     }
 }
예제 #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["yonetici"] == null || Request.QueryString.Count <= 0)
     {
         Response.Redirect("Anasayfa.aspx");
     }
     else
     {
         try
         {
             SqlDataSource1.Delete();
             Response.Redirect("adminPanel.aspx");
         }
         catch (Exception ex)
         {
             Response.Write(ex.Message);
         }
     }
 }
예제 #10
0
        protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
        {
            if (e.CommandName == "x")
            {
                SqlDataSource1.DeleteParameters["username"].DefaultValue = DataList1.DataKeys[e.Item.ItemIndex].ToString();
                SqlDataSource1.Delete();
            }
            if (e.CommandName == "s")
            {
                DataList1.EditItemIndex = e.Item.ItemIndex;
                DataList1.DataBind();
            }

            if (e.CommandName == "c")
            {
                TextBox t = new TextBox();
                t = (TextBox)e.Item.FindControl("TextBox1");

                SqlDataSource1.UpdateParameters["name"].DefaultValue     = t.Text;
                SqlDataSource1.UpdateParameters["username"].DefaultValue = DataList1.DataKeys[e.Item.ItemIndex].ToString();
                SqlDataSource1.Update();

                DataList1.EditItemIndex = -1;
                DataList1.DataBind();
            }

            if (e.CommandName == "s")
            {
                DataList1.EditItemIndex = -1;
                DataList1.DataBind();
            }

            if (e.CommandName == "t")
            {
                TextBox t = new TextBox();
                t = (TextBox)e.Item.FindControl("TextBox2");

                SqlDataSource1.InsertParameters["username"].DefaultValue = t.Text;

                SqlDataSource1.Insert();
            }
        }
예제 #11
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(Session["Aid"]);

            string delQ = "DELETE FROM DELIVERY_AGENT WHERE \"agent_id\"=" + id;

            SqlDataSource1.DeleteCommand     = delQ;
            SqlDataSource1.DeleteCommandType = SqlDataSourceCommandType.Text;
            int row = SqlDataSource1.Delete();

            if (row > 0)
            {
                Response.Redirect("~/AdminAgent.aspx");
                Label1.Text = "Suspended Successfully :(";
            }
            else
            {
                Label1.Text = "Failed";
            }
        }
 protected void ShoppingCart_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName.ToString() == "ViewDetail")
     {
         Session.Add("ItemID", e.CommandArgument.ToString());
         Server.Transfer("ProductDetail.aspx");
     }
     else if (e.CommandName.ToString() == "DeleteItem")
     {
         SqlDataSource1.DeleteCommand = "delete from ShoppingCart where Id = " + e.CommandArgument.ToString() + " and [Buyer] = '" + Page.User.Identity.Name + "'";
         SqlDataSource1.Delete();
     }
     else if (e.CommandName.ToString() == "OwnerDetail")
     {
         SqlDataSource1.SelectCommand = "SELECT Memberships.Email FROM (SELECT Users.UserId FROM ShoppingCart INNER JOIN NewsItems ON ShoppingCart.Id = NewsItems.Id INNER JOIN Users On NewsItems.Owner = Users.UserName WHERE ShoppingCart.Id = " + e.CommandArgument.ToString() + ") AS derivedtbl_1 INNER JOIN Memberships ON derivedtbl_1.UserId = Memberships.UserId";
         DataView dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
         SqlDataSource1.SelectCommand = "SELECT NewsItems.Id, NewsItems.Name, NewsItems.[Content], NewsItems.Price, NewsItems.Date FROM NewsItems INNER JOIN (SELECT Id FROM ShoppingCart WHERE (Buyer = '" + Page.User.Identity.Name + "')) AS derivedtbl_1 ON NewsItems.Id = derivedtbl_1.Id";
         //Response.Write("<SCRIPT language=\"javascript\">open('mailto:" + dv.Table.Rows[0][0] + "','_blank','top=0,left=0,status=yes,resizable=yes,scrollbars=yes');</script>");
         lbl_sellerinfo.Text    = "You may contact the seller at his email address: " + dv.Table.Rows[0][0];
         lbl_sellerinfo.Visible = true;
     }
 }
예제 #13
0
    protected void Button3_Click(object sender, EventArgs e)
    {
        //try
        //{
        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            GridViewRow rr = GridView1.Rows[i];

            if (((CheckBox)rr.FindControl("CheckBox1")).Checked)
            {
                Literal lit1 = (Literal)rr.FindControl("Literal1");
                SqlDataSource1.DeleteParameters["Original_d_id"].DefaultValue = lit1.Text;
                SqlDataSource1.Delete();
            }
            else
            {
            }
        }
        //Label1.Text = "";
        //}
        //catch { };//Label1.Text = "عفوا لا يمكنك حذف التصنيف , هناك عناصر مرتبطة"; };
    }
예제 #14
0
    protected void ButtonLink_Click(object sender, EventArgs e)
    {
        //ArrayList al = new ArrayList();
        foreach (GridViewRow R in GvCompany.Rows)
        {
            Session["UserRoleId "] = R.Cells[1].Text.Trim();

            RadioButton ch = (RadioButton)R.FindControl("C1");

            if (ch.Checked)
            {
                SqlDataSource1.Delete();
                SqlDataSourceUsersType.Insert();
                foreach (TreeNode node in TreeView1.CheckedNodes)
                {
                    Session["MenuIdd"] = node.Value.Trim();

                    SqlDataSource1.Insert();
                }
            }
            LabelErrorMessage.Text = "تم حفظ البيانات";
        }
    }
예제 #15
0
        protected void DeleteButton_Click(object sender, EventArgs e)
        {
            try {
                foreach (DataListItem item in DataList1.Items)
                {
                    String StatId = DataList1.DataKeys[item.ItemIndex].ToString();

                    bool isChecked = ((CheckBox)item.FindControl("DeleteBox")).Checked;

                    if (isChecked)
                    {
                        SqlDataSource1.DeleteParameters["StatIdParam"].DefaultValue = StatId;

                        SqlDataSource1.Delete();
                        //System.Diagnostics.Debug.WriteLine("Deleted Value:" + StatId);
                    }
                }
                DataList1.EditItemIndex = -1;
                DataList1.DataBind();
            } catch (FormatException) {
            } finally {
            }
        }
예제 #16
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                String thisID = TextBox1.Text;

                String sql = "DELETE FROM Books WHERE ID = ";
                sql = sql + "'";
                sql = sql + thisID;
                sql = sql + "'";

                Label1.Text = sql;
                SqlDataSource1.DeleteCommand = sql;

                SqlDataSource1.Delete();
                Label1.Text     = SqlDataSource1.DeleteCommand.ToString();
                Label1.CssClass = "label";
            }
            catch (Exception)
            {
                Label1.Text     = "ERROR! something went wrong.";
                Label1.CssClass = "error";
            }
        }
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "btdelete")
     {
         int i   = Convert.ToInt32(e.CommandArgument);
         int key = Convert.ToInt32(GridView1.DataKeys[i].Values[0].ToString());
         //DataRowView rowview =(DataRowView)GridView1.Rows[i].DataItem;
         string fileurl = GridView1.DataKeys[i].Values[1].ToString();
         if (drType.SelectedValue == "1")
         {
             if (DealFile.FilePicDelete(fileurl))
             {
                 SqlDataSource1.DeleteCommand     = "usp_DeleteSource";
                 SqlDataSource1.DeleteCommandType = SqlDataSourceCommandType.StoredProcedure;
                 SqlDataSource1.DeleteParameters.Add("SourceId", DbType.Int32, key.ToString());
                 SqlDataSource1.DeleteParameters.Add("type", DbType.Int32, drType.SelectedValue);
                 SqlDataSource1.Delete();
                 GridView1.DataBind();
             }
         }
         else if (drType.SelectedValue == "2")
         {
             string pptfile       = fileurl.Substring(0, fileurl.LastIndexOf(".")) + ".html";
             string pptfilefolder = fileurl.Substring(0, fileurl.LastIndexOf(".")) + ".files";
             if (DealFile.FilePicDelete(fileurl) && DealFile.FilePicDelete(pptfile) && DealFile.DeleteFolder(pptfilefolder))
             {
                 SqlDataSource1.DeleteCommand     = "usp_DeleteSource";
                 SqlDataSource1.DeleteCommandType = SqlDataSourceCommandType.StoredProcedure;
                 SqlDataSource1.DeleteParameters.Add("SourceId", DbType.Int32, key.ToString());
                 SqlDataSource1.DeleteParameters.Add("type", DbType.Int32, drType.SelectedValue);
                 SqlDataSource1.Delete();
                 GridView1.DataBind();
             }
         }
     }
 }
예제 #18
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (IsPostBack && Upload.HasFile)
            {
                if (Path.GetExtension(Upload.FileName).Equals(".xlsx"))
                {
                    var excel = new ExcelPackage(Upload.FileContent);
                    var dt    = excel.ToDataTable();
                    var table = "excelimport";
                    using (var conn = new SqlConnection("Server=yourservername;Database=yourdatabasename;User Id=yourid;Password=yourpassword;Integrated Security=false"))

                    {
                        var bulkCopy = new SqlBulkCopy(conn);
                        bulkCopy.DestinationTableName = table;
                        conn.Open();
                        var schema = conn.GetSchema("Columns", new[] { null, null, table, null });
                        foreach (DataColumn sourceColumn in dt.Columns)
                        {
                            foreach (DataRow row in schema.Rows)
                            {
                                if (string.Equals(sourceColumn.ColumnName, (string)row["COLUMN_NAME"], StringComparison.OrdinalIgnoreCase))
                                {
                                    bulkCopy.ColumnMappings.Add(sourceColumn.ColumnName, (string)row["COLUMN_NAME"]);
                                    break;
                                }
                            }
                        }
                        SqlDataSource1.Delete();
                        bulkCopy.WriteToServer(dt);
                        Response.Write("<script>alert('Contribution file as been successfully uploaded..');window.location = 'excelupload.aspx';</script>");
                        SqlDataSource1.Update();
                        GridView1.Visible = true;
                    }
                }
            }
        }
예제 #19
0
 protected void btn1_Click(object sender, EventArgs e)
 {
     SqlDataSource1.Delete();
     Response.Write("<script>alert('You are Deleted from roommate chat')</script>");
     Server.Transfer("~/Account/UserPanel.aspx");
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            int n = SqlDataSource1.Delete();

            Server.Transfer("MyViews.aspx");
        }
예제 #21
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     SqlDataSource1.Delete();
     Response.Redirect("ViewCategory.aspx");
 }
예제 #22
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     SqlDataSource1.Delete();
     Reset();
 }
예제 #23
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     SqlDataSource1.DeleteCommand = "Delete from [account] where Id=" + DropDownList1.SelectedValue;
     SqlDataSource1.Delete();
     DropDownList1.DataBind();
 }
예제 #24
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        GridView grilla   = (GridView)sender;
        int      index    = -1;
        string   producto = "";

        if (e.CommandName == "Update")
        {
            index    = grilla.EditIndex;
            producto = grilla.DataKeys[index].Value.ToString();
            var descripcion     = grilla.Rows[index].FindControl("txtDescripcionMod") as TextBox;
            var unidad          = grilla.Rows[index].FindControl("ddlUnidadMod") as DropDownList;
            var familia         = grilla.Rows[index].FindControl("ddlFamiliaMod") as DropDownList;
            var linea           = grilla.Rows[index].FindControl("ddlLineaMod") as DropDownList;
            var detalles        = grilla.Rows[index].FindControl("txtDetallesMod") as TextBox;
            var ddlCategoriaMod = grilla.Rows[index].FindControl("ddlCategoriaMod") as DropDownList;
            var observaciones   = grilla.Rows[index].FindControl("txtObservacionesMod") as TextBox;
            var agranel         = grilla.Rows[index].FindControl("chkGranelMod") as CheckBox;
            var aIVA            = grilla.Rows[index].FindControl("chkIVAMod") as CheckBox;


            string granel = "0";
            if (agranel.Checked)
            {
                granel = "1";
            }
            string IVA = "0";
            if (aIVA.Checked)
            {
                IVA = "1";
            }

            SqlDataSource1.UpdateCommand = "update catproductos set id_categoria=@id_categoria, descripcion=@descripcion, idMedida=@idMedida,idFamilia=@idFamilia,idLinea=@idLinea,detalles=@detalles,observaciones=@observaciones,granel=@granel,IVA=@IVA where idProducto=@idProducto";
            SqlDataSource1.UpdateParameters.Add("idProducto", producto);
            SqlDataSource1.UpdateParameters.Add("descripcion", descripcion.Text);
            SqlDataSource1.UpdateParameters.Add("id_categoria", ddlCategoriaMod.SelectedValue);
            SqlDataSource1.UpdateParameters.Add("idMedida", unidad.SelectedValue);
            SqlDataSource1.UpdateParameters.Add("idFamilia", familia.SelectedValue);
            SqlDataSource1.UpdateParameters.Add("idLinea", linea.SelectedValue);
            SqlDataSource1.UpdateParameters.Add("detalles", detalles.Text);
            SqlDataSource1.UpdateParameters.Add("observaciones", observaciones.Text);
            SqlDataSource1.UpdateParameters.Add("granel", granel);
            SqlDataSource1.UpdateParameters.Add("IVA", IVA);
            try
            {
                SqlDataSource1.Update();
                grilla.EditIndex = -1;
                grilla.DataBind();
                llenaGrid();
            }
            catch (Exception ex)
            {
                lblErrores.Text = "Error al actualizar el producto " + producto + ": " + ex.Message;
            }
        }
        else if (e.CommandName == "Delete")
        {
            string[] valores = e.CommandArgument.ToString().Split(new char[] { ';' });
            producto = valores[0];
            string estatus = valores[1];
            if (estatus == "A")
            {
                SqlDataSource1.DeleteCommand = "update catproductos set estatus='B' where idProducto=@idProducto " +
                                               "update articulosalmacen set cantidadExistencia=0 where idArticulo=@idProducto";
            }
            else
            {
                SqlDataSource1.DeleteCommand = "update catproductos set estatus='A' where idProducto=@idProducto";
            }
            SqlDataSource1.DeleteParameters.Add("idProducto", producto);
            try
            {
                SqlDataSource1.Delete();
                grilla.EditIndex = -1;
                grilla.DataBind();
            }
            catch (Exception ex)
            {
                lblErrores.Text = "Error al cambiar de estatus el producto " + producto + ": " + ex.Message;
            }
        }
    }
 protected void btnRemoveContact_Click(object sender, EventArgs e)
 {
     SqlDataSource1.Delete();
     lbContacts.DataBind();
 }
예제 #26
0
 protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     SqlDataSource1.Delete();
 }
예제 #27
0
 protected void BTN_Supprimer_Click(object sender, EventArgs e)
 {
     SqlDataSource1.Delete();
     LBL_Info.Text = "Le cheque supprimer avec succes";
 }
 protected void btnXoa_Click(object sender, EventArgs e)
 {
     SqlDataSource1.Delete();
     XoaTest();
 }
예제 #29
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     SqlDataSource1.Delete();
 }
예제 #30
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        GridView grilla  = (GridView)sender;
        int      index   = -1;
        string   usuario = "";

        if (e.CommandName == "Update")
        {
            index   = grilla.EditIndex;
            usuario = grilla.DataKeys[index].Value.ToString();
            var    nombre          = grilla.Rows[index].FindControl("txtNomMod") as TextBox;
            var    ap              = grilla.Rows[index].FindControl("txtApPatMod") as TextBox;
            var    am              = grilla.Rows[index].FindControl("txtApMatMod") as TextBox;
            var    fechaNacimiento = grilla.Rows[index].FindControl("txtFechaMod") as TextBox;
            var    direccion       = grilla.Rows[index].FindControl("txtDireccionMod") as TextBox;
            var    telefono        = grilla.Rows[index].FindControl("txtTelefonoMod") as TextBox;
            var    contasena       = grilla.Rows[index].FindControl("txtPasswordMod") as TextBox;
            var    puesto          = grilla.Rows[index].FindControl("ddlPuestoMod") as DropDownList;
            var    perfil          = grilla.Rows[index].FindControl("ddlPerfilMod") as DropDownList;
            var    correo          = grilla.Rows[index].FindControl("txtCorreoMod") as TextBox;
            string fechaProceso;
            if (fechaNacimiento.Text == "")
            {
                fechaProceso = "1900-01-01";
            }
            else
            {
                fechaProceso = fechaNacimiento.Text;
            }

            string apellidoMaterno = "";
            try { apellidoMaterno = Convert.ToString(am.Text); } catch (Exception) { apellidoMaterno = ""; }
            bool fechaValida = validaFecha(fechaProceso);


            if (fechaValida)
            {
                SqlDataSource1.UpdateCommand = "update usuarios_PV set nombre=@nombre, apellido_pat=@apellido_pat,apellido_mat=@apellido_mat,f_nacimiento=@f_nacimiento,puesto=@puesto,perfil=@perfil,direccion=@direccion,telefono=@telefono,password=@password,correo=@correo where usuario=@usuario";
                SqlDataSource1.UpdateParameters.Add("usuario", usuario);
                SqlDataSource1.UpdateParameters.Add("nombre", nombre.Text);
                SqlDataSource1.UpdateParameters.Add("apellido_pat", ap.Text);
                SqlDataSource1.UpdateParameters.Add("apellido_mat", apellidoMaterno);
                SqlDataSource1.UpdateParameters.Add("f_nacimiento", fechaProceso);
                SqlDataSource1.UpdateParameters.Add("puesto", puesto.SelectedValue);
                SqlDataSource1.UpdateParameters.Add("perfil", perfil.SelectedValue);
                SqlDataSource1.UpdateParameters.Add("direccion", direccion.Text);
                SqlDataSource1.UpdateParameters.Add("telefono", telefono.Text);
                SqlDataSource1.UpdateParameters.Add("password", contasena.Text);
                SqlDataSource1.UpdateParameters.Add("correo", correo.Text);
                try
                {
                    SqlDataSource1.Update();
                    grilla.EditIndex = -1;
                    grilla.DataBind();
                }
                catch (Exception ex) {
                    lblErrores.Text = "Error al actualizar al usuario " + usuario + ": " + ex.Message;
                }
            }
            else
            {
                lblErrores.Text = "Debe indicar una fecha de nacimiento válida y menor a la fecha actual";
            }
        }
        else if (e.CommandName == "Delete")
        {
            string[] valores = e.CommandArgument.ToString().Split(new char[] { ';' });
            usuario = valores[0];
            string estatus = valores[1];
            if (estatus == "A")
            {
                SqlDataSource1.DeleteCommand = "update usuarios_PV set estatus='B' where usuario=@usuario";
            }
            else
            {
                SqlDataSource1.DeleteCommand = "update usuarios_PV set estatus='A' where usuario=@usuario";
            }
            SqlDataSource1.DeleteParameters.Add("usuario", usuario);
            try
            {
                SqlDataSource1.Delete();
                grilla.EditIndex = -1;
                grilla.DataBind();
            }
            catch (Exception ex)
            {
                lblErrores.Text = "Error al actualizar al usuario " + usuario + ": " + ex.Message;
            }
        }
    }