Email a web control

D

David C

Does anyone know how to email a web control filled with data to someone? I
would like to email any web control (GridView, Calendar, etc.) to someone.
Thanks.

David
 
S

Scott M.

You can't do this for a couple of reasons, the most important of which is
that the control itself doesn't actually have any data in it. The data
comes from the conrol's data source. The control is just the pretty
container for something else's data. The second reason is that a control is
not a file, and as such, can't be attached to an email.

What you *could* do is serialize the data source of the control (like a
DataSet) into XML and send that XML via email, where someone on the other
side could then de-serialize it back into a DataSet.

But, I have to ask, why in the world do you want to do this? This is what
Web Services and WCF is for.

-Scott
 
D

David C

I am able to export a gridView to Excel and attach it to an email, so I
thought maybe there was a way to just grab the HTML table that is output and
send it as an HTML email or something.

The Calendar control I am using is the one I found at codeproject.com and
wanted to be able to email the filled in calendar. That also outputs an
HTML table. Our web site lets users view their "calendar" and they want to
be able to email that calendar to a 3rd party.

I guess I am not wanting to email the actual control, but the result that I
send to the browser. Does that help? Thank you.

David
 
D

David

In that case, you should be able to capture the render of the gridview and
override it to get the HTML out.

You need to use streams and htmlwriters and whatever. I can't remember all
the details, but searching for render htmlwriter c# should get you some
examples...
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
 
G

Gregory A. Beamer \(Cowboy\) - MVP

You can certainly set up a button that fires an "email" event on the
backend. You can then rip through the rows and create the same HTML to send
in an email. I would see if there is a third party component for this before
coding it, however, as it is a lot of work.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top