Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > update of custom control

Reply
Thread Tools

update of custom control

 
 
John Bankhead
Guest
Posts: n/a
 
      12-21-2004
I created a user control that displays different subsets of data depending on
the value of its public property "Folder". I placed the control on my page
along with four asp:buttons to represent the four different folders. The
clicking a button fires off the folder_click function which in turn sets the
Folder property on the user control.

The situation that I had was that I would not see the folder change until
there were two round-trips to the server. The data that shown was always one
click behind.

To fix this, I placed the line: this.ChildControlsCreated = false; in the
set section of the Folder property. And it worked.

So my question is: Is this what I should have done? Or is it just a patch?


--
John Bankhead
 
Reply With Quote
 
 
 
 
Victor Garcia Aprea [MVP]
Guest
Posts: n/a
 
      12-23-2004
Hi John,

What you're doing seems ok. If what you're developing is a composite custom
control and you perform some action (i.e. in response of a click event) that
will alter its child controls tree then you need to set ChildControlsCreated
to false in order to invalidate the current child controls tree; ASP.NET
will take care of recreating them when needed (i.e. just before rendering)
by calling CreateChildControls again.

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
My blog: http://clariusconsulting.net/vga
My profile: http://aspnet2.com/mvp.ashx?vga

"John Bankhead" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I created a user control that displays different subsets of data depending
>on
> the value of its public property "Folder". I placed the control on my
> page
> along with four asp:buttons to represent the four different folders. The
> clicking a button fires off the folder_click function which in turn sets
> the
> Folder property on the user control.
>
> The situation that I had was that I would not see the folder change until
> there were two round-trips to the server. The data that shown was always
> one
> click behind.
>
> To fix this, I placed the line: this.ChildControlsCreated = false; in the
> set section of the Folder property. And it worked.
>
> So my question is: Is this what I should have done? Or is it just a
> patch?
>
>
> --
> John Bankhead



 
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
Custom control within a custom control J R M ASP .Net 2 06-01-2006 06:04 PM
Capturing event from other custom control within another custom control Jonah Olsson ASP .Net 1 04-05-2005 01:39 PM
Capturing event from other custom control within another custom control Jonah Olsson ASP .Net Web Controls 2 04-05-2005 12:56 PM
ASP.Net Server Control (Web Custom Control) Code Update Problem Pete Mahoney ASP .Net Web Controls 3 09-02-2004 05:48 AM
ControlDesigner not invoked on custom control when control is rendered within another custom control Matt Sokol ASP .Net Building Controls 2 08-07-2003 07:13 AM



Advertisments