(Mike Moore [MS])
1/14/2003 4:54:00 AM
Hi Troy,
The code-behind is actually an abstract class. It can't do anything by
itself. The ASPX page inherits the code-behind. The ASPX page then runs as
itself, which includes everything it inherited from the code-behind. Again,
the code-behind doesn't do anything. It's the object that inherits the
code-behind that actually runs.
So, now you have some code that simply tells the repeater control to render
itself. The ASPX page inherits this along with the rest of he code-behind.
Then someone browses the page. When it gets to the line of code to render
the repeater control, it does call the repeater's render function. However,
the control's render function expects to be inside a hierarchy of controls
which includes a parent form control. The page's render event does all this
work in the expected order. It parses the ASPX page and creates objects
representing each server object. It adds sub-controls to the controls
collections of parent controls. When all the controls are in place, they
each are nested appropriately.
I'll look into this more tomorrow.
Thank you, Mike Moore
Microsoft, ASP.NET
This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
>From: "Troy Busot" <troy@busot.com>
>Subject: Render a repeater to a file?
>Date: Mon, 13 Jan 2003 15:23:11 -0700
>Lines: 24
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2720.3000
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
>Message-ID: <#U4ySJ1uCHA.1096@TK2MSFTNGP10>
>Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
>NNTP-Posting-Host: hawk73.t-bird.edu 192.160.35.73
>Path: cpmsftngxa06!TK2MSFTNGP08!TK2MSFTNGP10
>Xref: cpmsftngxa06
microsoft.public.dotnet.framework.aspnet.webcontrols:8492
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
>
>I'm trying to capture the contents of a Repeater object and write it to a
>file and still show the repeater on screen.
>
> StreamWriter writer = new StreamWriter( @"c:\write\output.txt" );
> HtmlTextWriter hWriter = new HtmlTextWriter( writer );
> repeater.RenderControl( hWriter );
>
>Doing the above code almost works. I get the repeater written to the screen
>perfectly, but there are two problems:
> 1) When I call RenderControl(), the repeater outputs some of the text
to
>the screen. So outside of the actual Repeater output (which is good), I get
>some extra content from the repeater to show up on screen.
>
> 2) Exactly 4k gets written to the file - that's it. I can specify a
>buffer size in while creating the StreamWriter object, but it just seems to
>bounce between 3K and 4K - not sure what I'm doing wrong here.
>
>Any thoughts?
>
>Thanks.
>Troy Busot
>
>
>
>