Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Access to controls in placeholder
Message
De
11/09/2009 18:36:52
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
ASP.NET
OS:
Windows XP SP2
Divers
Thread ID:
01423345
Message ID:
01423788
Vues:
31
>>Hi All,
>>
>>I have a page with a placeholder on it and am adding controls dynamically and with ajax postbacks. There is also a button on the page so when the user is finished and clicks this button I need to retrieve values from the controls added in the placeholder. The problem is when the button click fires, the placeholder.controls.Count is 0 when I know there were just two controls on the page.
>>
>>Now if I add the controls in the Page Load event they would be available to me in the exact same method. It appears to be because they are dynamically loaded (via ajax) later in the cycle. What can I do to have access to controls dynamically placed?
>>Thanks for any help.
>>Tim
>
>I'm not sure I follow. You have to reload the controls on every postback if they were added dynamically. I believe they need to be loaded in Page_Load at the latest in order for viewstate/events to be hooked up correctly. When you click on your button the Page_Load will run, then the Click event of the button is fired (and if you reloaded the controls in Page_Load you'd now be able to access them in the Click event).

They are loaded dynamically because they are not always needed. When specific data is chosen the controls are loaded via a control event. Then later when data needs to be saved, I have to get the values that were entered in the control. Sounds like I need to keep track somehow of what controls were loaded on every postback just to see if I need to reload them. Funny thing is I can't just see what controls are in the placeholder to be able to load them so I can query then later. What might be the most efficient way to keep track of what controls I add to a placeholder so I can reload them again?
Thanks
Tim
Timothy Bryan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform