Exemplo n.º 1
0
        // ****************************************************************
        // InitializeControlTemplate
        //
        /// <summary>
        /// This control uses a user control for a template. This function
        /// initializes the control and attempts to call FindControl on the
        /// controls that it needs access to in order to render properly
        /// </summary>
        // ****************************************************************
        private void InitializeControlTemplate()
        {
            Button button;

            // Find and populate the drop down list with the available templates
            emailTemplates = (DropDownList)controlTemplate.FindControl("emailTemplateList");
            emailTemplates.DataTextField  = "Description";
            emailTemplates.DataValueField = "EmailTemplateID";
            emailTemplates.DataSource     = Emails.GetEmailTemplateList();
            emailTemplates.DataBind();
            emailTemplates.AutoPostBack          = true;
            emailTemplates.SelectedIndexChanged += new System.EventHandler(EmailTemplate_Changed);

            // Set up the button used to update the email template
            button        = (Button)controlTemplate.FindControl("UpdateTemplate");
            button.Text   = " Update Template ";
            button.Click += new System.EventHandler(UpdateTemplate_Click);

            // Find the status control
            status         = (Label)controlTemplate.FindControl("Status");
            status.Visible = false;

            // Find the subject text box and the body textbox
            subject = (TextBox)controlTemplate.FindControl("Subject");
            body    = (TextBox)controlTemplate.FindControl("Body");

            DisplayEditMode();
        }