asp:asp中的Repeater:内容

时间:2009-10-13 16:33:57

标签: asp.net

我有以下代码:

<asp:Content id="Content1" runat="server" contentplaceholderid="PlaceHolderPageDescription">
            <table class="custom-table">
                    <asp:Repeater ID="oRepeater" runat="server" >
                        <ItemTemplate>
                            <tr onclick="javascript:location.href='/nuovoTema/viewIdea.aspx?ID='">
                                <td><%# ((SPListItem)Container.DataItem)["ID"] %></td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>     
            </table>            
</asp:Content>

编译器抱怨In content pages, content is not allowed outside <script> or <asp:Content> regions

我如何一起使用asp:Content和asp:Repeater?我有一个要显示的列表。

由于

1 个答案:

答案 0 :(得分:0)

看起来不是错误出现在您发布的页面部分中。通常,当您在Web内容页面中尝试将内容放置在asp:content块之外时弹出,或者b)出现某种标记错误 - 缺少结束标记或类似 - 这使得解析器想想你将代码放在内容块之外。

检查您的代码,确保所有需要关闭的内容实际上已关闭。一个好的开始方法是简单地删除内容块中的所有内容 - 好吧,将其复制到某个地方 - 然后查看页面是否仍然抱怨。 (你可能会在后面的代码中得到错误。)