|
-
Sep 19th, 2003, 11:29 AM
#1
Thread Starter
Addicted Member
How do I get a usercontrol to get the page to stop?
I want to write a usercontrol that when certain conditions are true, it tells the page to stop generating content and flush.
How do I do that?
If I use the Response Object, it Flushes and Ends before any content is rendered.
Example (really abstract)
Page 1 has an image, then, the usercontrol, then six more images.
If condition is true, then I want Page1 to render the 1st image, the usercontrol, and all the other images after that.
If condition is false, then I want Page1 to render the first image, then the usercontrol and stop.
Any ideas?
-
Sep 19th, 2003, 01:02 PM
#2
PowerPoster
Why don't you incorporate all the images and logic code to display them in a seperate control? You can just hae one literal control on the form, and you can set it's .Text property to the html you want to show. Then you check what images you want to add, build up the html for those images, and set the .Text property to that and you are done.
-
Sep 22nd, 2003, 08:10 AM
#3
Thread Starter
Addicted Member
Because this usercontrol is meant to be used on many different pages, but the effect is still the same.
That's ok.
I figured it out anyway.
I iterate throught the Controls property of the parent, make all of them after the instance of the UserControl not visible, then hold them in a collection persisted in the session object.
Then when the condition is satsfied, I re-add them to the Parent's Controls collection, skipping Literal Controls.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|