Welcome Guest Search | Active Topics | Sign In | Register

AJAXUploader and LayoutTemplate Options
Søren Jørgensen
Posted: Saturday, February 21, 2009 5:15:35 PM
Rank: Newbie
Groups: Member

Joined: 2/21/2009
Posts: 4
When using a custom layout template for the AJAXUploader and the template is loaded from an ascx file, the file input control is not inserted into the "InputPlaceHolder" placeholder - why not??

In a page class:
myUploader.LayoutTemplate = this.LoadTemplate("/templates/uploaderTemplate.ascx");

When inserting the layout template directly into the page file, it work though!
eo_support
Posted: Saturday, February 21, 2009 5:39:50 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Try to call the code inside your Page_Init and see if it works. I believe if LayoutTemplate is initialized too late the uploader won't be able to pick it up.

Thanks!
Søren Jørgensen
Posted: Saturday, February 21, 2009 6:20:11 PM
Rank: Newbie
Groups: Member

Joined: 2/21/2009
Posts: 4
Hi,

Hmm - the template is actually set in the page OnInit method:

protected override void OnInit(EventArgs e) {
base.OnInit(e);
..Some stuff
myUploader.LayoutTemplate = this.LoadTemplate("/templates/uploaderTemplate.ascx");
..Some stuff
}

Even doing it in OnPreInit won't do the job :-/
eo_support
Posted: Sunday, February 22, 2009 11:34:44 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

We looked further into this issue and noticed that this occurs because the parent/child relationship is different when using LoadTemplate. The parent child relationship is:

AJAXUploader -> Layout container -> InputPlaceHolder

With LoadTemplate the parent child relationship is:

AJAXUploader -> Layout container -> your_ascx -> InputPlaceHolder

Unfortunately I do not see an easy way to workaround this issue. One workaround is to create your own class that implements ITemplate, which calls LoadTemplate to load the "ascx -> InputPlaceHolder" version first, then get all the child controls of the root ascx control, then "move" all these child controls as direct child controls of the template container (the container argument passed to your InstantiateIn method. However this will lose whatever logic that you have on your ascx level, and it is also quite complicate. So it may not worth the effort.

Thanks!
Søren Jørgensen
Posted: Monday, February 23, 2009 2:12:18 AM
Rank: Newbie
Groups: Member

Joined: 2/21/2009
Posts: 4
Hi,

OK - thanks. I will work around this somehow.

I will implement the template in the page instead.

Funny that only the input is not found (the progress and buttons seems to be initialized fine) - but i'm not gonna dig deaper into this - thats why i bought your fine product the first way.

Would be nice to be able to put own logic into the template in future releases though :-)

Thanks..
eo_support
Posted: Monday, February 23, 2009 7:27:56 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Thanks for the update. We will look into it and see if we can support that in our future release.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.