Leave a Reply

3 comments

  1. is this the correct vb port:

    Me.AppRelativeTemplateSourceDirectory = Page.AppRelativeTemplateSourceDirectory

    Me.OnInit(e)

    i just don’t know ehere to put it.

    Will Beantwoorden

  2. This VB code should work AFAIK. You should put it in your own TemplateControl derived class, as an override of the OnInit function, as shown in the posting.

    In the postings sample, it would be the OnInit function of the NavController class.

    The VB syntax would be:

    Protected Overloads OnInit(EventArgs e)

    Begin

    Me.AppRelativeTemplateSourceDirectory = Page.AppRelativeTemplateSourceDirectory

    Me.OnInit(e)

    End

    Raimond Beantwoorden

  3. Hi Raimond,

    I tried your workaround, but it doesn’t work. My class from where I call the LoadControl() method looks like this:

    namespace myNSbla

    {

    public class RenderContent : System.Web.UI.Page

    {

    private void NoRecord()

    {

    this.AppRelativeTemplateSourceDirectory = base.AppRelativeTemplateSourceDirectory;

    myobj tpl = (myobj)this.LoadControl("path");

    tpl.ArticleId = Guid.Empty;

    ContentPlaceholder.Controls.Add(tpl);

    }

    protected override void OnInit(EventArgs e)

    {

    this.AppRelativeTemplateSourceDirectory = Page.AppRelativeTemplateSourceDirectory;

    base.OnInit(e);

    }

    }

    }

    This class is located in a class library project, and is called from codebehind from a .aspx. I’ve tried all I know, but nothing works 🙁

    Greetings from Germany in hope of help 😉

    Thomas Beantwoorden