示例#1
0
        protected void RowEditingEvent(object sender, GridViewEditEventArgs e)
        {
            int        codigo = Convert.ToInt32(GVUsuarios.DataKeys[e.NewEditIndex].Values[0]);
            DTOUsuario user   = new DTOUsuario();

            user.Id = codigo;
            ViewState["id_user"] = codigo;
            CADUsuario procesos = new CADUsuario();

            rolesuser.ClearSelection();
            if (procesos.CompletarRegistroParaModificarUsuario(user, identificacion, nombres, apellidos, email, password, confirmpassword, telefono) == 0)
            {
                if (procesos.CompletarRolesRegistroUserParaModificar(user, rolesuser) == 0)
                {
                    Button1.CssClass = "btn btn-default";
                    Button1.Enabled  = false;
                    //FileUpload1.Enabled = false;
                    Button2.CssClass = "btn btn-default";
                    Button2.Enabled  = true;
                    Button3.CssClass = "btn btn-default";
                    Button3.Enabled  = true;
                }
                else
                {
                    identificacion.Text  = "";
                    nombres.Text         = "";
                    apellidos.Text       = "";
                    email.Text           = "";
                    password.Text        = "";
                    confirmpassword.Text = "";
                    telefono.Text        = "";
                    ScriptManager.RegisterClientScriptBlock(this, GetType(), "error", "problema();", true);
                }
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "error", "problema();", true);
            }
            GVUsuarios.EditIndex = -1;
            procesos.CargarUsuarios(GVUsuarios);
        }