Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Master.PAGEID = 1;
        Page.Header.DataBind();
        if (!Page.IsPostBack)
        {
            /*Countries Drop Down List Generation*/
            CountryRepository CntryList = new CountryRepository();
            ExtendedCollection<Country> LC = CntryList.GetCountryList();

            Country[] Countries = new Country[LC.Count];
            LC.CopyTo(Countries, 0);
            for (int i = 0; i < Countries.GetLength(0); i++)
            {
                Cntry.Items.Add(Countries[i].Name);
            }

            /*State List - Sample Code*/
            StateRepository StateList = new StateRepository();
            ExtendedCollection<State> LS = StateList.GetStateList(97);

            /*City List - Sample Code*/
            CityRepository CityList = new CityRepository();
            ExtendedCollection<City> LCity = CityList.GetCityList(8);

            /*ExamCategory Repeater Bind */
            ExamCategoryRepository ECList = new ExamCategoryRepository();
            ExtendedCollection<ExamCategory> EC = ECList.GetECList();
            ExamCategory[] ECs = new ExamCategory[EC.Count];
            EC.CopyTo(ECs, 0);
            for (int i = 0; i < ECs.GetLength(0); i++)
            {
                ExamCategoryList.Items.Add(new ListItem(ECs[i].ExamName.ToString(), ECs[i].ECID.ToString()));
            }
        }
        HideFormIfLogin.Visible = true;
        if (Page.IsPostBack)
        {
            securecode = HttpContext.Current.Session["randomstruserreg"].ToString();
        }

        //Check whether user is login, if login, hide the registration form.
        //We don't want to allow users who are logon to register.
        //if they want to regsiter a new a count, they must logout first.
        if (Authentication.IsUserAuthenticated)
        {
            HideFormIfLogin.Visible = false;
            lblWarningMessage.Visible = true;
            lblWarningMessage.Text = "Sorry! You cannot register a new account when you are logon.<br>If you want to register for a new account, you must logout first.";
        }
    }