Patrick, thanks for the code sample. The sample works fine for rendering a Web Server Control in a console application, but having trouble with adapting to my scenario. I need to be able to capture a control in the state that the user submitted. I have tried incorporating your below example, but I get the following exception when attempting to extract the html:
Exception Details: System.Web.HttpException: Control 'Calendar1' of type 'MyCalendar' must be placed inside a form tag with runat=server. Source Error: Line 315: Dim html As HtmlTextWriter = New HtmlTextWriter(sw) Line 316: Line 317: Me.Render(html) Note that my code to render the control in a click event for a server side button control. I am trying to reconstruct a calendar that is in the user's post (not in the GET). Any further thoughts? Tommy -----Original Message----- From: Patrick Steele [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 26, 2002 12:09 PM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Capture html of server control into a string Try subclassing the calendar control. Here's a quickie sample: http://radio.weblogs.com/0110109/stories/2002/06/27/gettingTheRawHtmlFro mAWebControl.html --- Patrick Steele ([EMAIL PROTECTED]) Lead Software Architect Image Process Design > -----Original Message----- > From: Tommy Ryan [mailto:[EMAIL PROTECTED]] > Sent: Monday, December 23, 2002 7:52 PM > To: [EMAIL PROTECTED] > Subject: [ADVANCED-DOTNET] Capture html of server control > into a string > > > I have a calendar control that contains checkboxes for > selections for each > day of the month. I would like to send an email with html > content that > represents what has been selected by the user on the calendar. I have > tried several ways to capture the html of a submitted calendar server > control. I want to be able to capture the html of the > calendar control > (after the selections are made) and build out an email that > includes the > calendar. > > The email is the easy part and currently I am iterating through the > controls collection to get the selections made. The part I > am missing is > the html for the calendar. I have the data for what is selected and I > could build out the calendar myself with html tags, but I > rather just use > what is submitted to me and have the Calendar Server Control > do the work. > I have tried using the RenderControl method, but I think I am > barking up > the wrong tree. The error I get when trying I am attempt to > render to a > StringBuilder is: > > Exception Details: System.Web.HttpException: Control 'Calendar1' of > type 'Calendar' must be placed inside a form tag with runat=server. > > Does anyone have a better approach? > > > > TIA > > Tommy > > You can read messages from the Advanced DOTNET archive, > unsubscribe from Advanced DOTNET, or > subscribe to other DevelopMentor lists at http://discuss.develop.com. > > You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.