Re: Are dynamically loaded controls preserved over a postback?



you have to recreate the dynamic comtrol on postback. there is no code in
the placeholder for this.

-- bruce (sqlwork.com)

"Alan Silver" <alan-silver@xxxxxxxxxxxx> wrote in message
kbQ$lsKW569CFwf$@nospamthankyou.spam">news:kbQ$lsKW569CFwf$@nospamthankyou.spam...
> 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

  • Are dynamically loaded controls preserved over a postback?
    ... 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. ...
    (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)
  • Re: Are dynamically loaded controls preserved over a postback?
    ... If the value of that dropdownlist isn't preserved (ie if recreating the user control resets the child controls), ... I have a placeholder, which gets a user control added in when the page ... over the postback. ... Alan Silver ...
    (microsoft.public.dotnet.framework.aspnet)
  • Checkbox state after postback
    ... I have a pge on which is a placeholder. ... After a postback however (the controls are all rebuilt) IF the checkbox was ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Problem with webcontrol state using PlaceHolder within ASCX file
    ... Form1.aspx -> contains a placeholder and nothing else, ... It creates a dynamic control (a textbox) within the OnInit ... When running Form1, if after a postback, you try and capture the value ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)