我有个问题。
我写了这段代码:
<asp:ListView ID="ListComment" runat="server">
<LayoutTemplate>
<asp:PlaceHolder ID="itemPlaceHolder" runat="server"></asp:PlaceHolder>
</LayoutTemplate>
<ItemTemplate>
<div class="CommentArea" id='Comment<%#Eval("Id")%>'>
<div class="UserDate">
<span class="font07em fontunderline"><b>Inviato da: </b></span><span class="font07em"><b><a href="#"><%#Eval("Autore") %></a></b></span><span class="font07em fontunderline"><b> alle <%#Eval("Orario", "{0:hh':'mm}") %></b></span>
</div>
<div class="LikeDontLike">
<span class="font07em"><b>
<asp:LinkButton runat="server" ID="Like" CommandArgument='<%#Eval("Id")%>' OnClick="Mipiace_Click" >Like</asp:LinkButton>: <%#Eval("Mipiace") %> /
<asp:LinkButton runat="server" ID="DontLike" CommandArgument='<%#Eval("Id")%>' OnClick="Nonmipiace_Click" >Don't Like</asp:LinkButton>: <%#Eval("Nonmipiace") %></b></span>
</div>
<div class="UserComment">
<span class="font07em"><%#Eval("Commento") %></span>
</div>
</div>
</ItemTemplate>
</asp:ListView>
<asp:DataPager runat="server" ID="PageComment" PagedControlID="ListComment" PageSize="2">
<Fields>
<asp:NumericPagerField />
</Fields>
</asp:DataPager>
当我运行它并单击 DataPager 的页面时,它不会更改视图。如果我再次单击,它会改变。我试图将 DataPager 放入 LayoutTemplate,但我总是遇到同样的问题。我该如何解决?谢谢大家!