Welcome Guest Search | Active Topics | Sign In | Register

LayoutTemplate using code C# Options
alhambra eidos
Posted: Wednesday, May 6, 2009 2:54:21 AM
Rank: Newbie
Groups: Member

Joined: 5/6/2009
Posts: 2
Hi all,

I have a ITemplate, and I set it to LayoutTemplate in my control AjaxFileUpload that inherits from EO.Web.AJAXUploader.

But when pages render not is right.

Any help please ?

Thanks

My control AjaxFileUpload

public class AjaxFileUpload : EO.Web.AJAXUploader
...
Code: C#
protected override void CreateChildControls() 
{

AjaxFileUpload_LayoutTemplate template = new AjaxFileUpload_LayoutTemplate();
this.LayoutTemplate = template;

base.CreateChildControls();
}



My ITemplate

Code: C#
public class AjaxFileUpload_LayoutTemplate : ITemplate
{
public void InstantiateIn(System.Web.UI.Control container)
{
var inputPlaceHolder = new HtmlGenericControl("PlaceHolder") { ID = "InputPlaceHolder" }; 

var progressBar = new ProgressBar();
progressBar.ID = "ProgressBar";
progressBar.ControlSkinID = "Windows_XP";

var hr = new HtmlGenericControl("hr");

var cancelButton = new ImageButton();
cancelButton.ID ="CancelButton";
cancelButton.ImageUrl="~/Images/Detener.png";
cancelButton.MarginLeft= new Unit(10, UnitType.Pixel);
cancelButton.MarginTop= new Unit(5, UnitType.Pixel);
cancelButton.ToolTip="Cancelar";

var deleteButton = new ImageButton();
deleteButton.ID ="DeleteButton";
deleteButton.ImageUrl="~/Images/Anular.png";
deleteButton.MarginLeft= new Unit(10, UnitType.Pixel);
deleteButton.MarginTop= new Unit(5, UnitType.Pixel);
deleteButton.ToolTip="Borrar ficheros seleccionados";
deleteButton.FirstColumn = false;
deleteButton.LastColumn = true;

var hr2 = new HtmlGenericControl("hr");

var postedFilesPlaceHolder = new HtmlGenericControl("PlaceHolder") { ID = "PostedFilesPlaceHolder" }; 


container.Controls.Add(inputPlaceHolder);
container.Controls.Add(progressBar);
container.Controls.Add(hr);
container.Controls.Add(hr2);
container.Controls.Add(cancelButton);
container.Controls.Add(hr2);
container.Controls.Add(deleteButton);
container.Controls.Add(hr2);
container.Controls.Add(hr2);
container.Controls.Add(postedFilesPlaceHolder);

// <LayoutTemplate>
// <asp:PlaceHolder ID="InputPlaceHolder" runat="server" />
// <eo:ProgressBar ID="ProgressBar" runat="server" ControlSkinID="Windows_XP" />
// <asp:PlaceHolder ID="ProgressTextPlaceHolder" runat="server" />
// <%//<RealeUI:Button ID="CancelButton" runat="server" Text="Cancelar" LastColumn="true" />
// //<RealeUI:Button ID="DeleteButton" runat="server" Text="Borrar ficheros seleccionados" /> %>
// <hr />
// <RealeUI:ImageButton ID="CancelButton" runat="server" ImageUrl="~/Images/Detener.png" MarginLeft="10px" MarginTop="5px" ToolTip="Cancelar" />
// <RealeUI:ImageButton ID="DeleteButton" runat="server" ImageUrl="~/Images/Anular.png" FirstColumn="false" MarginLeft="10px" MarginTop="5px" ToolTip="Borrar ficheros seleccionados" LastColumn="true" />
// <hr />
// <asp:PlaceHolder ID="PostedFilesPlaceHolder" runat="server" />
//</LayoutTemplate>


}
}
eo_support
Posted: Wednesday, May 6, 2009 9:08:31 AM
Rank: Administration
Groups: Administration

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

The type of your inputPlaceHolder and postedFilesPlaceHolder are wrong. They should be PlaceHolder type, not HtmlGenericControl. So the code should be:

Code: C#
var inputPlaceHolder = new PlaceHolder();
var postedFilesPlaceHolder = new PlaceHolder();


Please let us know if this works for you.

Thanks!
alhambra eidos
Posted: Monday, May 11, 2009 2:59:27 AM
Rank: Newbie
Groups: Member

Joined: 5/6/2009
Posts: 2
Ok, it's works now !!! Thanks !!!


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.