//
        //  Page_Init
        //
        public void Page_Init()
        {
            Security = new cAdvancedSecurity(this);
            if (!Security.IsLoggedIn()) Security.AutoLogin();
            if (!Security.IsLoggedIn()) {
                Security.SaveLastUrl();
                Page_Terminate("login.aspx");
            }

            // Table Permission loading event
            Security.TablePermission_Loading();
            Security.LoadCurrentUserLevel(TableName);

            // Table Permission loaded event
            Security.TablePermission_Loaded();
            if (!Security.IsLoggedIn()) {
                Security.SaveLastUrl();
                Page_Terminate("login.aspx");
            }
            if (!Security.CanAdd) {
                Security.SaveLastUrl();
                Page_Terminate("RegistrosVehiculoslist.aspx");
            }

            // UserID_Loading event
            Security.UserID_Loading();
            if (Security.IsLoggedIn()) Security.LoadUserID();

            // UserID_Loaded event
            Security.UserID_Loaded();

            // Create form object
            ObjForm = new cFormObj();

            // Global page loading event (in ewglobal*.cs)
            ParentPage.Page_Loading();

            // Page load event, used in current page
            Page_Load();
        }
        //
        // Page main processing
        //
        public void Page_Main()
        {
            // Open connection to the database
            Conn = new cConnection();

            // Initialize table object
            if (VehiculosAutorizados == null)
                VehiculosAutorizados = new cVehiculosAutorizados(this);
            if (Personas == null)
                Personas = new cPersonas(this);
            if (Usuarios == null)
                Usuarios = new cUsuarios(this);
            if (Security == null) Security = new cAdvancedSecurity(this);
            if (!Security.IsLoggedIn()) Security.AutoLogin();
            if (!Security.IsLoggedIn()) {
                ew_Write(Language.Phrase("NoPermission"));
                ew_End();
            }

            // Table Permission loading event
            Security.TablePermission_Loading();
            Security.LoadCurrentUserLevel("VehiculosAutorizados");

            // Table Permission loaded event
            Security.TablePermission_Loaded();
            if (!Security.IsLoggedIn()) {
                Security.SaveLastUrl();
                ew_Write(Language.Phrase("NoPermission"));
                ew_End();
            }
            if (!Security.CanList) {
                ew_Write(Language.Phrase("NoPermission"));
                ew_End();
            }

            // UserID_Loading event
            Security.UserID_Loading();
            if (Security.IsLoggedIn()) Security.LoadUserID();

            // UserID_Loaded event
            Security.UserID_Loaded();
        }
        //
        //  Page_Init
        //
        public void Page_Init()
        {
            Security = new cAdvancedSecurity(this);
            if (!Security.IsLoggedIn()) Security.AutoLogin();
            if (!Security.IsLoggedIn()) {
                Security.SaveLastUrl();
                Page_Terminate("login.aspx");
            }

            // Table Permission loading event
            Security.TablePermission_Loading();
            Security.LoadCurrentUserLevel(TableName);

            // Table Permission loaded event
            Security.TablePermission_Loaded();
            if (!Security.IsLoggedIn()) {
                Security.SaveLastUrl();
                Page_Terminate("login.aspx");
            }
            if (!Security.CanDelete) {
                Security.SaveLastUrl();
                Page_Terminate("Personaslist.aspx");
            }

            // UserID_Loading event
            Security.UserID_Loading();
            if (Security.IsLoggedIn()) Security.LoadUserID();

            // UserID_Loaded event
            Security.UserID_Loaded();

            // Global page loading event (in ewglobal*.cs)
            ParentPage.Page_Loading();

            // Page load event, used in current page
            Page_Load();
        }
        //
        //  Page_Init
        //
        public void Page_Init()
        {
            Security = new cAdvancedSecurity(this);
            if (!Security.IsLoggedIn()) Security.AutoLogin();
            if (!Security.IsLoggedIn()) {
                Security.SaveLastUrl();
                Page_Terminate("login.aspx");
            }

            // Table Permission loading event
            Security.TablePermission_Loading();
            Security.LoadCurrentUserLevel(TableName);

            // Table Permission loaded event
            Security.TablePermission_Loaded();
            if (!Security.IsLoggedIn()) {
                Security.SaveLastUrl();
                Page_Terminate("login.aspx");
            }
            if (!Security.CanAdd) {
                Security.SaveLastUrl();
                Page_Terminate("Usuarioslist.aspx");
            }

            // UserID_Loading event
            Security.UserID_Loading();
            if (Security.IsLoggedIn()) Security.LoadUserID();

            // UserID_Loaded event
            Security.UserID_Loaded();
            if (Security.IsLoggedIn() && ew_Empty(Security.CurrentUserID)) {
                ew_Session[EW_SESSION_FAILURE_MESSAGE] = Language.Phrase("NoPermission");
                Page_Terminate("Usuarioslist.aspx");
            }

            // Create form object
            ObjForm = new cFormObj();

            // Global page loading event (in ewglobal*.cs)
            ParentPage.Page_Loading();

            // Page load event, used in current page
            Page_Load();
        }
        //
        //  Page_Init
        //
        public void Page_Init()
        {
            Security = new cAdvancedSecurity(this);
            if (!Security.IsLoggedIn()) Security.AutoLogin();
            if (!Security.IsLoggedIn()) {
                Security.SaveLastUrl();
                Page_Terminate("login.aspx");
            }

            // Table Permission loading event
            Security.TablePermission_Loading();
            Security.LoadCurrentUserLevel(TableName);

            // Table Permission loaded event
            Security.TablePermission_Loaded();
            if (!Security.IsLoggedIn()) {
                Security.SaveLastUrl();
                Page_Terminate("login.aspx");
            }
            if (!Security.CanList) {
                Security.SaveLastUrl();
                Page_Terminate("login.aspx");
            }

            // UserID_Loading event
            Security.UserID_Loading();
            if (Security.IsLoggedIn()) Security.LoadUserID();

            // UserID_Loaded event
            Security.UserID_Loaded();

            // Get grid add count
            int gridaddcnt = ew_ConvertToInt(ew_Get(EW_TABLE_GRID_ADD_ROW_COUNT));
            if (gridaddcnt > 0)
                HistoricoVehiculos.GridAddRowCount = gridaddcnt;

            // Set up list options
            SetupListOptions();

            // Global page loading event (in ewglobal*.cs)
            ParentPage.Page_Loading();

            // Page load event, used in current page
            Page_Load();
        }
        //
        //  Page_Init
        //
        public void Page_Init()
        {
            Security = new cAdvancedSecurity(this);
            if (!Security.IsLoggedIn()) Security.AutoLogin();
            if (!Security.IsLoggedIn()) {
                Security.SaveLastUrl();
                Page_Terminate("login.aspx");
            }

            // Table Permission loading event
            Security.TablePermission_Loading();
            Security.LoadCurrentUserLevel(TableName);

            // Table Permission loaded event
            Security.TablePermission_Loaded();
            if (!Security.IsLoggedIn()) {
                Security.SaveLastUrl();
                Page_Terminate("login.aspx");
            }
            if (!Security.CanList) {
                Security.SaveLastUrl();
                Page_Terminate("login.aspx");
            }

            // UserID_Loading event
            Security.UserID_Loading();
            if (Security.IsLoggedIn()) Security.LoadUserID();

            // UserID_Loaded event
            Security.UserID_Loaded();

            // Get export parameters
            if (ew_NotEmpty(ew_Get("export"))) {
                Areas.Export = ew_Get("export");
            } else if (ew_NotEmpty(ew_Post("exporttype"))) {
                Areas.Export = ew_Post("exporttype");
            } else {
                Areas.ExportReturnUrl = ew_CurrentUrl();
            }
            gsExport = Areas.Export; // Get export parameter, used in header
            gsExportFile = Areas.TableVar; // Get export file, used in header
            string Charset = (ew_NotEmpty(EW_CHARSET)) ? ";charset=" + EW_CHARSET : ""; // Charset used in header

            // Write BOM
            if (Areas.Export == "excel" || Areas.Export == "word" || Areas.Export == "csv")
                HttpContext.Current.Response.BinaryWrite(new byte[]{0xEF, 0xBB, 0xBF});
            if (Areas.Export == "excel") {
                HttpContext.Current.Response.ContentType = "application/vnd.ms-excel" + Charset;
                ew_AddHeader("Content-Disposition", "attachment; filename=" + gsExportFile + ".xls");
            }

            // Get grid add count
            int gridaddcnt = ew_ConvertToInt(ew_Get(EW_TABLE_GRID_ADD_ROW_COUNT));
            if (gridaddcnt > 0)
                Areas.GridAddRowCount = gridaddcnt;

            // Set up list options
            SetupListOptions();

            // Setup export options
            SetupExportOptions();

            // Global page loading event (in ewglobal*.cs)
            ParentPage.Page_Loading();

            // Page load event, used in current page
            Page_Load();
        }
        //
        //  Page_Init
        //
        public void Page_Init()
        {
            Security = new cAdvancedSecurity(this);

            // Global page loading event (in ewglobal*.cs)
            ParentPage.Page_Loading();

            // Page load event, used in current page
            Page_Load();
        }
        //
        //  Page_Init
        //
        public void Page_Init()
        {
            Security = new cAdvancedSecurity(this);

            // Uncomment codes below for security
            //if (!Security.IsLoggedIn()) Security.AutoLogin();
            //if (!Security.IsLoggedIn())
            //	Page_Terminate("login.aspx");
            // Global page loading event (in ewglobal*.cs)

            ParentPage.Page_Loading();

            // Page load event, used in current page
            Page_Load();
        }