473,397 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

send ascx file's html code as email

Hi,
I want to send ascx file's html code as email.this ascx
file is summary of customer sale.and at last iwant to
send email to customer.how can i get and past ascx file's
html code to mail body.
Nov 19 '05 #1
3 2714
Sabri:
You can do something like this:

Control c = Page.LoadControl("x.ascx");
StringWriter sw = new StringWriter();
HtmlTextWriter writer = new HtmlTextWriter(sw) ;
string contents = null;
try{
c.RenderControl(writer);
contents = sw.GetStringBuilder().ToString();
}finally{
sw.Close();
writer.Close();
}

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Sabri AKIN" <an*******@discussions.microsoft.com> wrote in message
news:22****************************@phx.gbl...
Hi,
I want to send ascx file's html code as email.this ascx
file is summary of customer sale.and at last iwant to
send email to customer.how can i get and past ascx file's
html code to mail body.

Nov 19 '05 #2
thanks,
its work fine but i have to pass parameter to ascx file
like orderID.
how can i pass parameter to this webcontrol page with
this code.
-----Original Message-----
Sabri:
You can do something like this:

Control c = Page.LoadControl("x.ascx");
StringWriter sw = new StringWriter();
HtmlTextWriter writer = new HtmlTextWriter(sw) ;
string contents = null;
try{
c.RenderControl(writer);
contents = sw.GetStringBuilder().ToString();
}finally{
sw.Close();
writer.Close();
}

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Sabri AKIN" <an*******@discussions.microsoft.com> wrote in messagenews:22****************************@phx.gbl...
Hi,
I want to send ascx file's html code as email.this ascx
file is summary of customer sale.and at last iwant to
send email to customer.how can i get and past ascx file's html code to mail body.

.

Nov 19 '05 #3
Instead of passing parameters, use properties, that way you can set the
properties after you use the LoadControl method. You'll have to create a
reference as the actual type though instead of the base Control class in
order to set the properties correctly.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"Sabri AKIN" <an*******@discussions.microsoft.com> wrote in message
news:2c****************************@phx.gbl...
thanks,
its work fine but i have to pass parameter to ascx file
like orderID.
how can i pass parameter to this webcontrol page with
this code.
-----Original Message-----
Sabri:
You can do something like this:

Control c = Page.LoadControl("x.ascx");
StringWriter sw = new StringWriter();
HtmlTextWriter writer = new HtmlTextWriter(sw) ;
string contents = null;
try{
c.RenderControl(writer);
contents = sw.GetStringBuilder().ToString();
}finally{
sw.Close();
writer.Close();
}

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Sabri AKIN" <an*******@discussions.microsoft.com> wrote

in message
news:22****************************@phx.gbl...
Hi,
I want to send ascx file's html code as email.this ascx
file is summary of customer sale.and at last iwant to
send email to customer.how can i get and past ascx file's html code to mail body.

.

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Quentin | last post by:
I need to import an *;ascx, as an object, in my class, that is in myclass.vb. How can i do ? i saw the method LoadControl but i can't use it, or maybe i did wrong, if could help me it would be very...
3
by: | last post by:
Hello All, Would someone be able to tell me whether it is possible to encode an ASPX page or an ASCX user control into a DLL and later have the webapplication get the page out to the requesting...
4
by: Rob Meade | last post by:
Hi all, I have just put together our organisations 'template' for our web applications and have created 7 .ascx files which when dropped into my template file work perfectly...however, I have a...
7
by: moondaddy | last post by:
I have a user control being used instead of a frame page. when the user clicks on a menu item I need to send the ID (integer value) of that menu as a parameter in the postback of the user control...
7
by: Holger (David) Wagner | last post by:
Hi Group, I've searched the Web for precompilers that compile ASPX/ASCX pages just like it can be done with JSPs, but so far, I've only found approaches targetted at increasing the performance....
5
by: djscratchnsniffing | last post by:
i know you can access an ascx's properties/methods from an aspx file. Let's say you have an aspx file with two code-behind files(ascx files). Can you access one of the ascx file's...
0
by: damiensawyer | last post by:
Hello all, I'm very new to all of this. I have a theme and a skin (the standard ones). I have a standard master page which is holding a custom ascx which has a treeview in it. Can someone...
0
by: Brett Wesoloski | last post by:
I am trying to put javascript in an .ascx file. Although it seems to work no compile errors the button does nothing. This is what I have. In my grid a template column. Then above in the .ascx...
1
by: howboutafresca | last post by:
I'm in a bit of a pickle. I'm dealing with a web portal that uses a single aspx file at the top, which dynamically loads ascx controls into it. On one of these controls I have a textbox that I'd...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.