Re: Changing controls after an event

Tech-Archive recommends: Fix windows errors by optimizing your registry



You're going to need to have some state information somewhere that tells your server code what controls to recreate upon postback. You should recreate these controls in Page_Init (if it's directly in the Page) or override CreateChildControls, or if it's an ASCX then Page_Load is also a fine place to recreate these controls.

-Brock
DevelopMentor
http://staff.develop.com/ballen



Ah, can't do that as the forms are gernerated from data.. I just have
some code that's called for all forms so that I can put any special
coding for onchange in if needed.

"Eliyahu Goldin" <removemeegoldin@xxxxxxxxxxxxxx> wrote in message
news:%23U9O0n1OFHA.1176@xxxxxxxxxxxxxxxxxxxxxxx

Adrian,

The easiest way is to prepare all controls in design time and switch
their visibility on events.

Eliyahu

"Adrian Parker" <apparker@xxxxxxxxxx> wrote in message
news:u4RJbh1OFHA.3704@xxxxxxxxxxxxxxxxxxxxxxx

I have a form with some controls on it, one of them has an auto
postback onchange.  So the postback occurs but before the event
fires, all the controls are recreated. so my question is, if the
event requires you to replace a control with another type, e.g.
replace a textbox with a date control, how do I get it to redo the
form with the new control, force another postback ?  if so , how ?

Thanks
Adrian Parker



.



Relevant Pages

  • Re: Defining a Command for a LinkButton
    ... I do the controls to the form. ... But I'm not sure how to recreate them on ... > these on postback in order for the event handler to get hooked up and thus ... >> I'm trying to dinamically add LinkButton Controls to a web form. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: How to use dynamically added dropdownlist controls?
    ... > controls of my web form even at postbacks. ... Just recreate your list at postback. ... recreate all your controls exactly as before the postback. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Dynamic Control
    ... >> I made the following code but the bug is: ... > Controls that are created dynamically don't recreate themselves on ... > and recreate them all on postback. ...
    (microsoft.public.dotnet.framework.aspnet.buildingcontrols)
  • Re: Multithreading and Creating new controls
    ... The thing is that you have to call recreate handle in the UI thread. ... done just because the both handlers the parent (which is created by the UI ... controls added by the same thread you don't need to guard ... >> private void InitializeComponent() ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Control Buttons frozen
    ... i had to recreate all the buttons from scratch. ... Any chance someone opened the file using a Mac? ... Macs don't use those controls, ...
    (microsoft.public.excel.misc)