Bind data to GridView then check boxes


I have a SQL table that I am binding to a GridView in 4.
The table has and ID column, a column with a text question and then 5 bit
columns. The bit columns come up as check boxes on my page.
I want the user to be able to check one of the boxes and have it save to the table
but this is not possible.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ' This example uses Microsoft SQL Server and connects
        ' to the Northwind sample database. The data source needs
        ' to be bound to the GridView control only when the 
        ' page is first loaded. Thereafter, the values are
        ' stored in view state.                      
        If Not IsPostBack Then

            Dim queryString2 As String = _
  "Select * From Questions"

            ' Run the query and bind the resulting DataSet
            ' to the GridView control.
            Dim ds2 As DataSet = GetData(queryString2)
            If (ds.Tables.Count > 0) Then

                Me.GridView2.DataSource = ds2


                'Me.Label_Error1.Text = "Unable to connect to the database. " & Err.Description

            End If

        End If

    End Sub

Open in new window

Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


To save the checkbox state to the database, while saving the data, loop through the gridview rows and get the checkbox check status and set the booleam flags accordingly. On sending these data to database it can be saved to database.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
>I want the user to be able to check one of the boxes and have it save to the table
but this is not possible.

Have you tried? Does it save changes to other fields?
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.