protected void Page_Load(object sender, EventArgs e) { string formSessionKey = string.Format("{0}_{1}", GetType().Name, typeof(ContactForm).Name); ContactForm form = this.SessionGet(formSessionKey, () => new ContactForm()); if (form == null) { return; } form.SetPage(this); FormCommander formCommander = new FormCommander(form); FormRenderer formRenderer = new FormRenderer(form); formCommander.HandleRequest(IsPostBack, Request); ltrForm.Text = formRenderer.Render(); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); string formSessionKey = string.Format("{0}_{1}_{2}", Page.GetType().Name, GetType().Name, typeof(Form).Name); Form form = this.Page.SessionGet(formSessionKey, () => new Form()); if (form == null) { return; } form.SetPage(Page); FormCommander formCommander = new FormCommander(form); FormRenderer formRenderer = new FormRenderer(form); formCommander.HandleRequest(IsPostBack, Request); ltrContent.Text = formRenderer.Render(); }