编辑:新代码
<asp:Panel ID="pnl_display_commentaire" runat="server" GroupingText="Commentaires" >
<asp:LinkButton ID="btnmakecomment" class="linkhover" Font-Size="11px" runat="server"> Comments </asp:LinkButton>
<asp:Panel ID="pnlMComment" CssClass="" runat="server" >
<div class="commentbox">
<asp:TextBox ID="MakeComments" CssClass="unwatermarkedcomment" runat="server" Width="90%" TextMode="MultiLine"></asp:TextBox>
<asp:Button ID="btnPost" CssClass="submitButton" Text="Commenter" runat="server" OnClick="btnComment_Click" CommandName="Comment" CausesValidation="false" UseSubmitBehavior="False"/>
ajaxToolKit:TextBoxWatermarkExtender ID="TextBoxScrapWme" runat="server" TargetControlID="MakeComments" WatermarkText="Ecrire un commentaire" WatermarkCssClass="watermarked" />
</div>
</asp:Panel>
<ajaxToolKit:CollapsiblePanelExtender ID="cpe1" runat="Server" TargetControlID="pnlMComment" Collapsed="true" CollapsedText="Ajouter votre commentaire" ExpandedText="" TextLabelID="btnmakecomment" ExpandControlID="btnmakecomment" CollapseControlID="btnmakecomment" SuppressPostBack="true" />
<script src="https://code.jquery.com/jquery-1.12.2.min.js"></script>
<script type="text/javascript">
function Move() {
var shouldMove = true;
setInterval(function () {
var previous = $("a:contains('Previous')");
if (previous.html() != undefined && shouldMove) {
var grid = $("#CommentGridView");
$(previous).insertBefore($(grid));
shouldMove = false
}
}, 100);
$(document).on('click', "a:contains('Next')", function () {
shouldMove = true;
});
$(document).on('click', "a:contains('Previous')", function () {
shouldMove = true;
});
}
</script>
<asp:UpdatePanel ID="update_panel_comments" runat="server">
<ContentTemplate>
<asp:GridView ID="CommentGridView"
AutoGenerateColumns="true"
EnableSortingAndPagingCallbacks="true"
EmptyDataText="0 commentaire"
runat="server"
ShowHeader="false"
ShowFooter="true"
Width="90%"
AllowPaging="True"
PageSize="3"
GridLines="None"
OnPageIndexChanging="CommentGridView_PageIndexChanging">
<PagerSettings NextPageText="Next" PreviousPageText="Previous" Mode="NextPrevious" />
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnPost" EventName="Click" />
</Triggers>
我试图在我的GridView和数据底部显示下一页链接,并在gridview顶部显示上一个链接(如果需要显示)。
我怎样才能实现这个目标?
编辑: 我用console.log()测试了JS,它输入正确但什么也没做......