Repeater绑定List泛型对象

来源:互联网 发布:老滚5捏脸数据 编辑:程序博客网 时间:2024/05/29 17:45

后台:


public void BindData()
        {
            List<WeiBo> DataList = new List<WeiBo>();
            DataList = DBTools.GetPublishedWeiBo(user._id.ToString());
            Repeater_PubData.DataSource = DataList;

            Repeater_PubData.DataBind();
        }



前台:


  <asp:Repeater ID="Repeater_PubData" runat="server">
                <ItemTemplate>
                  <div class="contentItemKuang">
                    <div class="leftFace">
                        <img src="../Images/face.jpg" width="50px" height="50px" />
                    </div>
                    <div class="RightFont">
                        <%#((Model.WeiBo)Container.DataItem).Message %>
                        <p class="content_footer">
                            3月18日23:15 <span class="itemAction">转发 | 评论</span>
                        </p>
                    </div>
                </div>
                </ItemTemplate>
                </asp:Repeater>

原创粉丝点击