0

I need to find a way to figure out which checkboxes are clicked, and which ones aren't. Any ideas?

I couldn't use checkbox server controls because I needed the sames to reflect the database ID number.

 <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1">
        <HeaderTemplate>
            <asp:Label ID="lblHeader" runat="server" Text="Extra Cost Included  Price  Quantity" Font-Size="X-Small" Font-Bold="True"></asp:Label>
        </HeaderTemplate>
        <ItemTemplate>
            <input type="checkbox" id='cb<%# Eval("ID") %>'/> <input type="checkbox" id='cb<%# Eval("ID") %>inc'/>

            <div style="display:inline-block;width:300px;"><asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' /></div>
            <div style="display:inline-block;width:80px;"><asp:Label ID="PriceLabel" runat="server" Text='<%#  Convert.ToDecimal(Eval("Price")).ToString("C")  %>' /></div>
            <select id='ddl<%# Eval("ID") %>'>
                <option>1</option>
                <option>2</option>
                <option>3</option>
                <option>4</option>
                <option>5</option>
                <option>6</option>
                <option>7</option>
                <option>8</option>
                <option>9</option>
                <option>10</option>
                <option>11</option>
                <option>12</option>
                <option>13</option>
                <option>14</option>
                <option>15</option>
                <option>16</option>
                <option>17</option>
                <option>18</option>
                <option>19</option>
                <option>20</option>
            </select>

            <br />
        </ItemTemplate>
    </asp:DataList>
4

1 回答 1

1

You can use JQuery to do that.

$("input:checked").each(function(data){ //Do your operations over here. to push the ids into an array. });

I suppose you can also change the selector to check checkboxes inside a parent control.

Follow this link

于 2013-08-30T01:46:03.857 回答