Itemtemplate programatically, need help!

1 posts, 0 answers
  1. Pierre
    Pierre avatar
    138 posts
    Member since:
    Feb 2006

    Posted 14 Aug 2009 Link to this post

    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 %>"); 

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

    Many thanks, Romi

Back to Top