protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack == false)
        {
            //	First time initialisation.

            Page.Title = TXT_PAGETITLE;
            this.LblPageTitle.Text = TXT_PAGETITLE;

            ClassProject oPrj = new ClassProject();

            this.ddlProjects.DataSource = oPrj.ShowProjects();
            this.ddlProjects.DataTextField = "ProjectName";
            this.ddlProjects.DataValueField = "ProjectId";
            this.ddlProjects.DataBind();

            this.BtnAddProject.Enabled = true;

            if (this.ddlProjects.Items.Count > 0)
            {
                this.ddlProjects.Enabled = true;
                this.BtnDeleteProject.Enabled = true;
                this.BtnEditProject.Enabled = true;

                if (Request.QueryString["ProjectId"] != null)
                {
                    try
                    {
                        this.ddlProjects.SelectedValue = Request.QueryString["ProjectId"].ToString();
                    }

                    catch (Exception)
                    {
                        //	Do nothing. The project ID doesn't exist in the dropdown listbox.
                        //	This isn't an error.
                    }
                }
            }
            else
            {
                this.ddlProjects.Enabled = false;
                this.BtnDeleteProject.Enabled = false;
                this.BtnEditProject.Enabled = false;
            }
        }
    }
    private void ShowProjects()
    {
        this.ddlProjects.Items.Clear();
        this.DdlTasks.Items.Clear();

        this.ddlProjects.Enabled = false;
        this.DdlTasks.Enabled = false;

        ClassProject oPrj = new ClassProject();
        DataSet oDs = oPrj.ShowProjects();

        if (oDs != null)
        {
            if (oDs.Tables.Count > 0)
            {
                if (oDs.Tables[0].Rows.Count > 0)
                {
                    //	We have some projects.

                    this.ddlProjects.Enabled = true;

                    this.ddlProjects.DataSource = oDs;
                    this.ddlProjects.DataTextField = "ProjectName";
                    this.ddlProjects.DataValueField = "ProjectId";
                    this.ddlProjects.DataBind();

                    ShowTasks();
                }
            }
        }
    }
    private void ShowProjects()
    {
        ClassProject oPrj = new ClassProject();

        this.ddlProjects.DataSource = oPrj.ShowProjects();
        this.ddlProjects.DataTextField = "ProjectName";
        this.ddlProjects.DataValueField = "ProjectId";
        this.ddlProjects.DataBind();
    }