Sure:

Option Strict

Imports System
Imports System.Drawing
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.IO

Public Class App1
    Shared Sub Main()
        Dim ctl As MyTextBox = New MyTextBox()

        Console.WriteLine(ctl.GetHTML())
    End Sub
End Class

Public Class MyTextBox
    Inherits TextBox

    Public Sub New()
        Me.BackColor = Color.Red
        Me.Height = New Unit(200)
    End Sub

    Public Function GetHTML() As String
        Dim sw As StringWriter = New StringWriter()
        Dim html As HtmlTextWriter = New HTMLTextWriter(sw)

        Me.Render(html)
        Return sw.toString
    End Function
End Class

---
Patrick Steele ([EMAIL PROTECTED])
Lead Software Architect
Image Process Design



-----Original Message-----
From: dave wanta [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, May 29, 2002 10:49 AM
To: [EMAIL PROTECTED]
Subject: [DOTNET] email web controls?


hi all,
I've had a number of people ask me this and I don't know how to do this
(if possible). It would actually be interesting, if it is a perf hit.

Here goes...

Let's say I want to take advantage of ASP.NET 's built in controls, like
the DataGrid. I have a report that needs to be emailed out on a regular
basis, and rather than creating 80 - 100 lines of code, i could easily
just create a datagrid and bind my dataset to it.  This is done from a
console application.  Now I understand that WebControls detect browser
and need to run under ASP.NET, but is it possible to some how call
Render() outside of IIS, and get a stream of the html output (say HTML
3.2 compliant)?  Does this make sense? Has this been discussed before?
Am I going down a road I don't want to?    I've always said "just build
the HTML and email it".. .but I think it would be interesting to see if
I can get this to work...

Any thoughts?

Thanks,
--dave

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to