Selecting Multiple GridView Rows

Posted on 2007-10-01
Last Modified: 2013-11-26
I have a ASP.NET GridView Control that displays a user record.  I added a template colume in the GridView and within that template placed a checkbox.

I want users to be able to select multiple users from my gridview by checking the checkboxes that I put in the template field by their name.  When the user clicks and add user button I need that event handler to be albe to go to the gridview and see what items are selected based on my checkbox.

Is there any tutorial, code, or something out there to show me how to do this.  I can't find any in books or on the net now.
Question by:hoyaabanks
    LVL 13

    Expert Comment

    LVL 4

    Accepted Solution

    You can do something like this:

            Dim gr As GridViewRow
            For Each gr In gvMyGrid.Rows
                Dim cbox As CheckBox = gr.FindControl("Checkbox1")   'whatever you named it
                If (cbox.Checked = True) Then
                      do something
                End If


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
    Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now