protected void btnGrabar_OnClick(object sender, EventArgs e)
    {
        try
        {
            Int32    retorno;
            PerfilBL oPerfilBL = new PerfilBL();
            oPerfilBL.ErrorEvent += new PerfilBL.ErrorDelegate((Master as Seguridad).Transaction_ErrorEvent);

            this.CargaDesdeForm();

            retorno = oPerfilBL.GrabarPerfil(this.oPerfil);
            if (retorno > 0)
            {
                this.perfilID           = retorno;
                this.oPerfil.NID_PERFIL = this.perfilID;
                /*Insertamos detalle de opciones por perfil*/

                Int32 intRetornoP = 0;

                String XML = Global.ObtenerXmlPerfil(this.txhCodOpciones.Value, this.txhIndOpciones.Value, this.txhNidOpcionPerfil.Value.Trim());

                intRetornoP = oPerfilBL.InsertarOpcionByPerfil(this.oPerfil, XML);

                if (intRetornoP > 0)
                {
                    JavaScriptHelper.Alert(this, Message.keyGrabar, "");
                }
                else
                {
                    JavaScriptHelper.Alert(this, Message.keyErrorGrabar, "");
                }

                this.CargaPerfil();
            }
            else
            {
                JavaScriptHelper.Alert(this, Message.keyErrorGrabar, "");
            }
        }
        catch
        {
            JavaScriptHelper.Alert(this, Message.keyErrorGrabar, "");
        }
    }