Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
So my situation is like this, what I need to happen is to show the row data that are checked on the checkbox,

I have an initial solution, what I did is assign the table data ID as a tooltip to the checkbox, and will be displayed with,

txtShow.Text = txtShow.Text + myCheckbox.Tooltip.ToString

Is there a better of doing this, cause I definitely don't want to show the data ID as a tooltip for the checkbox. I'm a junior programmer and basically trying to work my way. Thanks for all the future help.

Basically I have the following codes,

IN ASPX
XML
<table>
    <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
        <ItemTemplate>
            <tr>
                <td>
                    <asp:CheckBox ID="cbRows" runat="server" ToolTip='<%# Eval("ID") %>' />
                </td>
                <td>
                    <%# Eval("ProductID")%>
                </td>
                <td>
                    <%# Eval("ProductName")%>
                </td>
            </tr>
        </ItemTemplate>
    </asp:Repeater>
</table>


In my Codebehind VB,

Protected Sub bCheck_Click(ByVal sender As Object, ByVal e As EventArgs) Handles bCheck.Click
        txtShow.Text = ""

        Dim i As Integer = 0
        Dim item As RepeaterItem
        For Each item In Repeater1.Items
            Dim myCheckBox As CheckBox = item.FindControl("cbRows")
            If Not myCheckBox Is Nothing And myCheckBox.Checked Then
            ' I put my initial code here, which uses the tooltip.
            End If
            i = i + 1
        Next
    End Sub
Posted
Comments
Er. Puneet Goel 3-Apr-14 0:21am    
Means you wan to show the product id and product name when checkbox is checked?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900