This is a migrated thread and some comments may be shown as answers.

Itemtemplate programatically, need help!

0 Answers 67 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
Pierre
Top achievements
Rank 1
Pierre asked on 14 Aug 2009, 03:58 PM
Hi team,

I have build one Rotator programaticaly implemented as Todd Anglin blog sample with ItemTemplate as Itemplate implementation. My problem is that my item template is rended as "Text" <%# Container.DataItem %> in place to be evaluated. Could you suggest some solution to be able to evaluate the content inside my rotator using codebehind.

C# as codebehind 
... 
Rot.ItemWidth = Unit.Pixel(300); 
Rot.ItemHeight = Unit.Pixel(200); 
Rot.ItemTemplate =new RotatorTemplate() ; 
... 
public class RotatorTemplate : ITemplate 
    #region ITemplate Membres 
    public void InstantiateIn(System.Web.UI.Control container) 
    { 
        LiteralControl lc1 = new LiteralControl("<%# Container.DataItem %>"); 
        container.Controls.Add(lc1);  

    } 
    #endregion 
}                
 
In my case i use one List<string> item that work perfect in static code as
<ItemTemplate>
<%# Container.DataItem %>
</ItemTemplate>

Many thanks, Romi

No answers yet. Maybe you can help?

Tags
Rotator
Asked by
Pierre
Top achievements
Rank 1
Share this question
or