Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8349469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:00:27+00:00 2026-06-09T08:00:27+00:00

Initially, we have a checkboxlist control on the markup page with ID=recs On that

  • 0

Initially, we have a checkboxlist control on the markup page with ID=”recs”

On that markup, we have check all / uncheck all checkboxes. This way, users can check one checkbox or several checkboxes.

We were able get the value(s) of checked boxes with the following code:

Protected Sub btnGetCheck_Click(ByVal sender As Object, ByVal e As EventArgs)

    Thread.Sleep(9000)

    Dim uItems As String = ""
    For i As Integer = 0 To recs.Items.Count - 1
        If recs.Items(i).Selected Then
            If uItems <> "" Then uItems = uItems & ","
            uItems = uItems & _
                "You checked" & recs.Items(i).Text & "from the db"

        End If
    Next
    Response.Redirect("sendto.aspx?p=" & Server.UrlEncode(uItems))
End Sub

This worked real well for us.

However, this morning, we were asked to add more columns to the markup. It turns out that this was not possible.

We decided to switch from checkboxlist to checkboxs using gridview.

I would appreciate asssistance with rewriting the above code to get checked items from the checkboxes in gridview.

Gridview code snip is below.

<asp:GridView ID="GridView1" runat="server"  HeaderStyle-CssClass = "header"
    AutoGenerateColumns = "false" Font-Names = "Arial"  OnRowDataBound = "RowDataBound"
    Font-Size = "11pt" AlternatingRowStyle-BackColor = "#C2D69B" >
   <Columns>
    <asp:TemplateField>
        <HeaderTemplate>
            <asp:CheckBox ID="checkAll" runat="server" onclick = "checkAll(this);" />
        </HeaderTemplate> 
       <ItemTemplate>
           <asp:CheckBox ID="recs" runat="server" onclick = "Check_Click(this)" />
       </ItemTemplate> 
    </asp:TemplateField> 
    <asp:BoundField ItemStyle-Width = "150px" DataField = "custid" HeaderText = "Customer ID" />
    <asp:BoundField ItemStyle-Width = "150px" DataField = "firstname" HeaderText = "First Name" />
    <asp:BoundField ItemStyle-Width = "150px" DataField = "lastname" HeaderText = "Last Name"/>
    <asp:BoundField ItemStyle-Width = "150px" DataField = "os"  HeaderText = "OS"/>
   </Columns> 
</asp:GridView>
       <asp:Button ID="btnGetCheck" runat="server" Text="Get Checked Items" onclick="btnGetCheck_Click" /><br />


Dim uItems As String = String.Empty

        For Each r As GridViewRow In GridView1.Rows

            If CType(r.Cells(0).FindControl("recs"), CheckBox).Checked Then

                If uItems <> String.Empty Then

                    uItems += ","

                End If

                uItems += "You checked " & CType(r.Cells(1).FindControl("recs"), CheckBox).Text & " from the db."
                Response.Write(uItems)
                Response.End()

            End If
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T08:00:28+00:00Added an answer on June 9, 2026 at 8:00 am

    Iterate through the rows of the GridView and grab a reference to the checkboxes using the FindControl method.

    Dim uItems As String = String.Empty
    
    For Each r As GridViewRow In GridView1.Rows
    
        If CType(r.Cells(0).FindControl("recs"), CheckBox).Checked Then
    
            If uItems <> String.Empty Then
    
                uItems += ","
    
            End If
    
            uItems += "You checked " & CType(r.Cells(0).FindControl("recs"), CheckBox).Text & " from the db."
    
        End If
    
    Next
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an iframe on a page that I need to initially have a
I have this jQuery datepicker code that initially set the minDate of the datepicker.
Initially I have this layout: <ul id=state_${abbr}></ul> on the jsp page and I need
The only control on the usercontrol is a datagridview, that initially should have two
I have a winforms app that initially displays a window with two file dialog
I have a page with a list of items initially loaded from a include_once('show_calendarV2.php');
I have a page where I am loading bunch of images initially when the
We have a new filestream database that will be initially loaded with 65GB data,
I have a form that I want to be validated before showing it initially.
I have a JLabel, a JButton, and a JTextField all arranged horizontally in that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.