本文介绍了在转发器控制中维护不同页面上的选中值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I have a Datalist Control, where there are multiple rows(3 rows per page).Each row has a checkbox as well. My requirement is that I want the checked items to come down in the Repeater control when I press the "Checkout" Button. But when I go to the next page the checked items on the previous page gets reset.
我尝试过的方法:
What I have tried:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" MaintainScrollPositionOnPostback="true" %>
<!DOCTYPE html>
<title>DL-A1
<div>
<asp:DataList ID="DataList1" runat="server" DataKeyField="bookid">
<itemtemplate>
<table><tbody><tr><td>
</td><td>
Title: <%# Eval("booktit") %><br>
Author: <%# Eval("bookaut") %><br>
Publisher: <%# Eval("bookpub") %><br>
Prc: <%# Eval("bookprc") %><br>
<asp:CheckBox ID="CheckBox1" runat="server" Text="Buy" Font-Bold="True" /><br>
</td></tr></tbody></table>
<asp:Repeater ID="rptPaging" runat="server" OnItemCommand="rptPaging_ItemCommand">
<itemtemplate>
<asp:LinkButton ID="lnkPage" runat="server" CommandName="Page" CommandArgument="<%# Container.DataItem %>"><%# Container.DataItem %>
<br>
<asp:Label ID="lbl1" runat="server" Text="Label" Font-Bold="True">
<br>
<br>
<asp:Button ID="Button1" runat="server" Text="Checkout" OnClick="extractCheckedVal" Font-Bold="True" Font-Size="X-Large" /><br><br><br>
<asp:Repeater ID="Repeater1" runat="server">
<headertemplate>
Total number of checked items: <%= v_tot %> <br>
Selected Items Are:
<itemtemplate>
<table><tbody><tr><td>
</td><td>
Title: <%# Eval("booktit") %><br>
Author: <%# Eval("bookaut") %><br>
Publisher: <%# Eval("bookpub") %><br>
Prc: <%# Eval("bookprc") %><br>
</td></tr></tbody></table>
</div>
推荐答案
这篇关于在转发器控制中维护不同页面上的选中值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!