How to change the layout of the CreateUserWizard control?

Posted by Bazzz on Stack Overflow See other posts from Stack Overflow or by Bazzz
Published on 2011-01-01T18:46:39Z Indexed on 2011/01/01 18:54 UTC
Read the original article Hit count: 262

How to change just the layout (template) of the CreateUserWizard control programmatically? I would to define another layout (not using the horrid table) but continue to use all the event handling and the creation of the user of the CreateUserWizard control. Just for reference, the following code doesn't work, and produces an unexpected result not representing my Template at all. The "InstantiateIn" method of the ITemplate is not called.

public partial class b : System.Web.UI.Page
    {
        protected void Page_Init(object sender, EventArgs e)
        {
            CreateUserWizard createUserWizard = new CreateUserWizard();
            createUserWizard.CreateUserStep.ContentTemplate = new Template();
            Panel1.Controls.Add(createUserWizard);
        }
    }

    public class Template : ITemplate
    {
        void ITemplate.InstantiateIn(Control container)
        {
            container.Controls.Add(new TextBox() { ID = "UserName" });
            container.Controls.Add(new TextBox() { ID = "Password" });
            container.Controls.Add(new TextBox() { ID = "ConfirmPassword" });
            container.Controls.Add(new TextBox() { ID = "Email" });
            container.Controls.Add(new PlaceHolder() { ID = "ErrorMessage" });
        }
    }
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET