The code below should work, but the control may have to be added to a page otherwise it may throw exceptions.
MemoryStream stream = new MemoryStream(); StreamWriter writer = new StreamWriter(stream, Encoding.Unicode); HtmlTextWriter output = new HtmlTextWriter(writer); yourcontrol.RenderControl(output); output.Flush(); stream.Position = 0; string outputStr = New StreamReader(stream, Encoding.Unicode).ReadToEnd; > -----Original Message----- > From: John BouAntoun [mailto:[EMAIL PROTECTED] > Sent: Friday, 17 September 2004 9:11 AM > To: Todd Berman; Matthew Metnetsky > Cc: Mono - List > Subject: RE: [Mono-list] Capturing a Controls Rendered Html > > Why not look into asp.net's data caching . > > Seems like a perfect scenario for use, "static most of the > time, but changes ocasionally". > > JBA > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Todd Berman > Sent: Friday, 17 September 2004 8:20 AM > To: Matthew Metnetsky > Cc: Mono - List > Subject: Re: [Mono-list] Capturing a Controls Rendered Html > > > Maybe im missing something, but why not go to the page and > view the source? > > Or do you want to automate this programmatically? > > --Todd > > On Thu, 2004-09-16 at 16:13 -0400, Matthew Metnetsky wrote: > > I have a UserControl which contains all of my web pages header > > information (menus etc). The headers content is static > 99.999% of the > > > time, so I would like to capture the rendered output of the control > > and toss it into an HTML file for normal inclusion (and > remove it when > > > the file needs updating. But I'm getting lost following > the API from > > UserControl -> Control -> HtmlTextWriter -> TextWriter ->->-> > > > > So I'm wondering if anyone has done anything similar > before? I don't > > want the whole page, but rather just the text from one > control down to > > > its children. Any ideas or suggestions would be greatly > appreciated. > > > > ~ Matthew > > > > _______________________________________________ > > Mono-list maillist - [EMAIL PROTECTED] > > http://lists.ximian.com/mailman/listinfo/mono-list > > _______________________________________________ > Mono-list maillist - [EMAIL PROTECTED] > http://lists.ximian.com/mailman/listinfo/mono-list > _______________________________________________ > Mono-list maillist - [EMAIL PROTECTED] > http://lists.ximian.com/mailman/listinfo/mono-list > > _______________________________________________ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
