Rendering an UserControl inside a mail body without any page object reference

H

Henri

Hi
I would like to use a User Control to render the body of the mail I send.
I know how to do that using Page.LoadControl
The problem is that my application is not an ASP.NET page so I can't use any
Page object reference to call LoadControl
What should I do ?
Thanks

Henri
 
E

Edge

Henri said:
Hi
I would like to use a User Control to render the body of the mail I
send.
I know how to do that using Page.LoadControl
The problem is that my application is not an ASP.NET page so I can't
use any Page object reference to call LoadControl
What should I do ?
Thanks

Henri

Give the user control a class name. You can do that in the control directive
(in the ascx file):
<%@ Control Language="VB" Class="myUserControl" %>

Then, in the page that sends the mail, register the user control.
You can do that by adding the control to your page once, and then removing
it again.
This will add the register directive to the page.

Then you can use this line instead of Page.LoadControl (VB.NET):

Dim myControl1 As New myUserControl()
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top