Are dynamically loaded controls preserved over a postback?



Hello,

I have a placeholder, which gets a user control added in when the page first loads. This user control contains a dropdownlist, and I would like to get hold of the value of this drop down list form the calling page on postback. Can I do this? If I try and use FindControl on the placeholder, it can't find the dropdownlist.

I tried...

ShowCategory ctlShowCategory = (ShowCategory)plcCategoryDetails.Controls[0];

(where ShowCategory is the user control) but this gave the error...

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: index

which sounds like the user control wasn't preserved in the placeholder over the postback.

Any ideas how I do this? Hope this was clear!! TIA

--
Alan Silver
(anything added below this line is nothing to do with me)
.



Relevant Pages

  • Re: Are dynamically loaded controls preserved over a postback?
    ... you have to recreate the dynamic comtrol on postback. ... > I have a placeholder, which gets a user control added in when the page ... This user control contains a dropdownlist, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: User Control Disappears After PostBack - Why?
    ... > place it on an ASPX page at runtime using a PlaceHolder - which also has ... FWIW: during the postback the ... > does nothing with respect to the user control or to the PlaceHolder within ... What's the deal with the user control? ...
    (microsoft.public.dotnet.framework.aspnet)
  • User Control Disappears After PostBack - Why?
    ... I have a simple user control that has EnableViewState="true". ... After a postback, the aspx page renders back to the client, but the user ... does nothing with respect to the user control or to the PlaceHolder within ...
    (microsoft.public.dotnet.framework.aspnet)
  • WebUserControl and JavaScript
    ... I am new to ASP.NET I need some help for this scenario ... I have a template Page which loads a WebUserControl inside ... Now this Web User Control has a table with 2 rows ... Second row just has a placeholder ...
    (microsoft.public.dotnet.framework.aspnet)
  • Dynamically embedding Usercontrols in a page: Possible??
    ... I thought that I could simply create a placeholder and then add the relevant ... user control to the placeholder at runtime.. ... Object reference not set to an instance of an object. ... button on my contact form user control but it has not been created yet.. ...
    (microsoft.public.dotnet.framework.aspnet)

Loading