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

Discussion in 'ASP .Net Building Controls' started by Henri, Dec 11, 2004.

  1. Henri

    Henri Guest

    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
     
    Henri, Dec 11, 2004
    #1
    1. Advertising

  2. Henri

    Edge Guest

    Henri wrote:
    > 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()

    --

    Edge
     
    Edge, Dec 12, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rajesh Tiwari

    Can we use a usercontrol inside a usercontrol

    Rajesh Tiwari, Aug 12, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    418
    Rajesh Tiwari
    Aug 12, 2003
  2. nail
    Replies:
    0
    Views:
    1,546
  3. Henri
    Replies:
    0
    Views:
    358
    Henri
    Dec 11, 2004
  4. Fabiano
    Replies:
    2
    Views:
    604
    =?Utf-8?B?c3Jpbmk=?=
    Jun 3, 2005
  5. Spartaco

    usercontrol inside usercontrol

    Spartaco, Jul 31, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    603
    Spartaco
    Jul 31, 2007
Loading...

Share This Page