Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 11th, 2004, 02:43 PM
Authorized User
 
Join Date: Nov 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem In emailing a dynamic ASPX page in ASP.NET

I'm working on an application that contains an HTML page with empty labels.
those labels are filled on runtime according to a query in am SQLServer stored procedure.
the stored procedure has a parameter which is the document number and the page is filled according to this parameter.

how can isend this page a html email
my function is just sending the labels empty.
thank You

Georges M. Kaddoum
__________________
<GMK>
 
Old November 11th, 2004, 02:54 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

You can send your controls to a String Writer, then convert that to a string, and set that string as the body for your e-mail. The following code shows how to do that with a DataSet:
Code:
Dim myStringWriter As New System.IO.StringWriter
Dim myHtmlWriter As New System.Web.UI.HtmlTextWriter(myStringWriter)
Dim myDataGrid As New DataGrid
myDataGrid.DataSource = WhatEverItIsYouWantToBindTo
myDataGrid.DataBind()
myDataGrid.RenderControl(myHtmlWriter)

MyMailMessage.Body = myStringWriter.ToString()
You can do the same with other controls, as RenderControl is defined in the base class Control.

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Otherside by Red Hot Chili Peppers (Track 4 from the album: Californication) What's This?
 
Old November 16th, 2004, 03:47 AM
Authorized User
 
Join Date: Nov 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thank you very much
my problem has been solved using the code you provided me.

Georges M. Kaddoum
 
Old February 14th, 2005, 05:40 AM
Authorized User
 
Join Date: Nov 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

While working with this solutoin i faced a problem concerning "TEXTBOXES" i could not transform it to a stringwriter.
is there anyway to send the textbox and the data insde it as e-mail?

Otherwise is there anyway to control the data format in a datagrid column?
Please check the following POST:
http://p2p.wrox.com/topic.asp?TOPIC_ID=25827

Georges M. Kaddoum
 
Old February 15th, 2005, 03:06 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I don't think there's a need for the control to be "rendered". All you need to di is just ask for its Text property which returns a string that you can append to the mail body.

Or is that not enough?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old February 17th, 2005, 05:34 AM
Authorized User
 
Join Date: Nov 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well for the issue of textbox it could be enough but how can i handle the format of the data wthin a cell in the datagrid. All data is being retrieved from SQL server as merged data i want it to take the same format that has been saved.
In HTML we use the <PRE></PRE> tags to keep the same format is there any similar way inside a pecific datagrid cell?

Georges M. Kaddoum
 
Old February 19th, 2005, 08:11 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi again,

I am not sure what you mean. Can you explain your requirements in more detail?


Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET - Static Page and Dynamic Page sohrabus ASP.NET 2.0 Professional 2 April 18th, 2007 11:42 PM
Emailing the contents of an aspx page Mykhan ASP.NET 2.0 Professional 3 December 15th, 2006 03:41 AM
Opening and emailing Excel sheet through ASP.Net venterjo ASP.NET 1.0 and 1.1 Basics 0 October 10th, 2005 09:55 AM
dynamic emailing ips2004 JSP Basics 1 December 8th, 2004 01:57 PM
Shall i use ASP page and ASPX pages in in .net prj bvrao VS.NET 2002/2003 4 January 5th, 2004 04:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.