0

Let me tell you about objects in my page. I have a listview. And i have a checkbox in this listview(in itemTemplate tag). And i have a html button outside of listview. Id of listview is:"myListView". Id of checkbox is "checkBoxSec". Id is html button is "btnConfirmSelected". What is my purpose; Let's assume listview shows me 100 records when page loads. And let's assume i select some checkboxes. Let's assume i select these: 3, 5, 7, 33, 56, 78, 99. (let's assume these numbers are ID values of the selected records). When i click html button i need one string like this: 3, 5, 7, 33, 56, 78, 99 I need that javascript code. This javascript codes is going to find selected checkbox. and then get their values. and then put all values together with comma. i need that string. thanks. Let me share my code:

<asp:ListView ID="myListView" runat="server" OnItemCommand="listView_OnItemCommand"
OnItemDataBound="listView_ItemDataBound">
<LayoutTemplate>
    <table id="listViewRecordsTable" cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered table-condensed">
        <thead>
            <tr>
                <th style="text-align: left;">
                    <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="false" onchange="CheckAll(this);" />
                </th>
                <th style="text-align: left;">
                    process no
                </th>
            </tr>
        </thead>
        <tbody>
            <asp:PlaceHolder ID="itemPlaceholder" runat="server" />
        </tbody>
    </table>
</LayoutTemplate>
<ItemTemplate>
    <tr class="odd gradeX" id="<%# Eval("ID").ToString() == "BOS" ? "" : Eval("ID")%>">
        <td>
            <asp:CheckBox ID="checkBoxSec" runat="server" CssClass="checkBoxExample" Value='<%#Eval("ID") %>' />
        </td>
        <td>
            <%# Eval("surecID").ToString() == "empty" ? "" : Eval("surecID")%>
        </td>
    </tr>
</ItemTemplate>

and here is the html button

<input id="btnFindThem" type="button" value="find selected checkbox and get their values" />

thanks

mannyCalavera
  • 593
  • 1
  • 4
  • 23
  • Where is the javascript code? – Wouter van Vegchel Jan 25 '17 at 07:21
  • Dear @WoutervanVegchel, Actually, there is no js code because i am asking javascript code. I want someone to help me about it. I am not good at javascript. thanks – mannyCalavera Jan 25 '17 at 07:30
  • I won't write your complete code, but I can give you a starting point : http://stackoverflow.com/questions/786142/how-to-retrieve-checkboxes-values-in-jquery – Wouter van Vegchel Jan 25 '17 at 07:35
  • Dear @WoutervanVegchel, i have implemented that example. but i am getting "on" text. not id values of selected checkbox. let me give an example. let's assume i have selected these checkboxes: 3, 5, 7, 33, 56, 78, 99. i am getting this string: on, on, on, on ,on, on, on not 3, 5, 7, 33, 56, 78, 99. what do you think? – mannyCalavera Jan 25 '17 at 08:01
  • It should return me values of selected checkboxes. because i am setting value to "ID" for checkboxes `` @WoutervanVegchel – mannyCalavera Jan 25 '17 at 08:07
  • Dear @Reego, what about this question? Any idea? Same problem. but i am trying to solve this with javascript. Thanks. – mannyCalavera Jan 26 '17 at 05:05

0 Answers0