Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Running CreateChildren automatically on hidden server control

Reply
Thread Tools

Running CreateChildren automatically on hidden server control

 
 
Chris Smith
Guest
Posts: n/a
 
      10-26-2004
Hi
I am getting what appears to me as incorrect behavior from my server
control, but maybe its just that I don't fully understand the relationships
involved.

Here's the issue:

I have a templated server control that overrides CreateChildren() method.
However, if the control is hidden at page load (Visible="False" in the tag
definition), the CreateChildren method doesn't seem to fire. That's fine. I
wouldn't expect it to fire since its hidden.

However, when I then set the control's visibility to true (inside a method
on the page), the objects that should have been read from the template are
still not available (they are <undefined>). If, on the other hand, I always
set the control to be visible, everything works fine.

To make this an easy flow, imagine it like this:
Templated Server control, hidden on the ASPX page.
If control is visible, then it runs the CreateChildren() method
automatically to get the objects it needs from the template.
If the control is hidden at startup, then MADE visible inside page code, the
CreateChildren() never fires, so any operations done on objects that should
have been created in CreateChildren are unavailable.

Some help would be great on this one.


 
Reply With Quote
 
 
 
 
John Saunders
Guest
Posts: n/a
 
      10-27-2004
"Chris Smith" <> wrote in message
news:161FFAF0-F7CD-4F82-AB3E-...
> Hi
> I am getting what appears to me as incorrect behavior from my server
> control, but maybe its just that I don't fully understand the
> relationships
> involved.
>
> Here's the issue:
>
> I have a templated server control that overrides CreateChildren() method.
> However, if the control is hidden at page load (Visible="False" in the tag
> definition), the CreateChildren method doesn't seem to fire. That's fine.
> I
> wouldn't expect it to fire since its hidden.
>
> However, when I then set the control's visibility to true (inside a method
> on the page), the objects that should have been read from the template are
> still not available (they are <undefined>). If, on the other hand, I
> always
> set the control to be visible, everything works fine.


When did you want CreateChildControls to be called? When are you trying to
access the child controls? Whatever you're doing to access the child
controls, EnsureChildControls() should be called in order to make sure the
child controls are there.

-----
John Saunders


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate Hidden field on post back and retrieve value from Hidden Field Rick ASP .Net 3 04-13-2010 05:38 PM
Win 7 folders hidden despite 'show hidden' checked Boppy NZ Computing 10 01-23-2010 02:56 AM
Set hidden values and then submit automatically staeri@gmail.com ASP .Net 2 09-04-2006 04:34 PM
How would I discover the text in a block element hidden by overflow:hidden style being set? SolarCanine Javascript 2 09-20-2005 06:27 PM
HTML Client Control versus. HTML Server Control versus. Web Server Control Matthew Louden ASP .Net 1 10-11-2003 07:09 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57