I am using Repeater control to display data from Database table in HTML table on ASPX page. There are also two link buttons Approve and Rejectwhich are bind with Repeater method ItemCommand.
There is a checkbox in first column of each row. This will enable user to select multiple rows and perform Approve and Reject operation. Here is the code:
<asp:Repeater ID="PendingRegRepeater" runat="server" OnItemCommand="PendingRegRepeater_ItemCommand">
<HeaderTemplate>
<table>
<thead>
<tr>
<th>
Select
</th>
<th>
Customer Name
</th>
<th>
Space ID
</th>
<th>
Date
</th>
<th>
Amount Paid
</th>
<th>
Pin Code
</th>
<th>
Payment Method
</th>
<th>
Action
</th>
</tr>
</thead>
</HeaderTemplate>
<ItemTemplate>
<tbody>
<tr>
<td>
<asp:CheckBox runat="server" />
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "CustomerName") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "SpaceID") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "TransactionDate") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "AmountPaid") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "Pincode") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "PaymentMethod") %>
</td>
<td>
<asp:LinkButton ID="lnkApprove" CommandName="Approve" CommandArgument='<%# Eval("RRID") %>' Text="Approve" runat="server" ForeColor="Black" Font-Underline="true"></asp:LinkButton>
/
<asp:LinkButton ID="lnkReject" CommandName="Reject" CommandArgument='<%# Eval("RRID") %>' Text="Reject" runat="server" ForeColor="Black" Font-Underline="true"></asp:LinkButton>
</td>
</tr>
</tbody>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
But I am unable to think a way to handle when user selects multiple checkboxes and presses Approve or Reject button. The compiler won't allow me to set ID attribute of Check-box a dynamic value <%# Eval("RRID") %>. Please suggest to handle this situation. thanks.