如何在转发器控件asp.net中放置div标签和文章标签

时间:2015-04-07 18:24:03

标签: c# asp.net html5

我使用HTML5模板建立帖子状态和评论页面。如何在转发器控件asp.net中放置<div>标记和<article>标记?

<asp:Repeater ID="repeater" runat="server"><div class="profile-stories">
    <article class="story" runat="server">
        <aside class="user-thumb">
            <a href="#">
                <img src="assets/images/thumb-1.png" alt="" class="img-circle" />
            </a>
        </aside>
        <div class="story-content">
            <!-- story header -->
            <header>
                <div class="publisher">
                    <a href="#">Art Ramadani</a> posted a status update
                <em>3 hours ago</em>
                </div>
                <div class="story-type">
                    <i class="entypo-feather"></i>
                </div>
            </header>
            <div class="story-main-content">
                <p>Tolerably earnestly middleton extremely distrusts she boy now not. Add and offered prepare how cordial two promise. Greatly who affixed suppose but enquire compact prepare all put. Added forth chief trees but rooms think may. </p>
            </div>
            <footer>
                <!-- story comments -->
                <ul class="comments">
                    <li>
                        <div class="user-comment-thumb">
                            <img src="assets/images/thumb-1.png" alt="" class="img-circle" width="30" />
                        </div>
                        <div class="user-comment-content">
                            <a href="#" class="user-comment-name">Harold Bella
                            </a>
                            Mean if he they been no hold mr. Is at much do made took held help. Latter person am secure of estate genius at. 
                        <div class="user-comment-meta">
                            <a href="#" class="comment-date">January 2 at 3:25pm</a>
                        </div>
                        </div>
                    </li>
                    <li class="comment-form">
                        <div class="user-comment-thumb">
                            <img src="assets/images/thumb-1.png" alt="" class="img-circle" width="30" />
                        </div>
                        <div class="user-comment-content" runat="server">
                            <asp:TextBox ID="txtComment" CssClass="form-control autogrow" TextMode="MultiLine" runat="server"></asp:TextBox>
                            <asp:LinkButton ID="btnComment" CssClass="btn" Text='<i class="entypo-chat"></i>' runat="server"></asp:LinkButton>
                        </div>
                    </li>
                </ul>
            </footer>
            <!-- separator -->
            <hr />
        </div>
    </article>
</div></asp:Repeater>

我该如何解决这个问题?如果我不能使用转发器控制,我怎么能这样做呢?

1 个答案:

答案 0 :(得分:0)

需要重复的项目应包含在ItemTemplate中。如果你的外部div不是重复的东西,那么将开头的内容放在HeaderTemplate和FooterTemplate中的结束标记

更多关于此的内容:http://www.w3schools.com/aspnet/aspnet_repeater.asp