Checkboxes in a Datagrid problem

Discussion in 'ASP .Net Datagrid Control' started by REB, Mar 1, 2004.

  1. REB

    REB Guest

    I have a datagrid that retrieves 3 fields per record row from a SQL server
    2000 database table, the data it retrieves looks like this:

    Violation Notice Date Type of Violation
    <True/False> 3/1/03 Speeding
    <True/False> 2/10/04 Ran a stop light

    The <True/False> is a checkbox and signifies that we have received the
    paperwork for the violation. Now onto my problems. First off I changed the
    first column to a templated column and put in a checkbox and set its
    databind text and checked propety to use the correct column from the data
    source (source is a SQL bit column that only contains a 0 or a 1). This
    worked, but only for the first row in the grid, each additional row would
    show the same exact value from the first row. For example, I had 3 records
    and if the first one had a value of true all of them showed true even though
    I verified that some were false. If I changed the first row to a false
    value in SQL table then all rows show false.

    My second problem is when a checkbox is changed (CheckChanged event) I want
    to save the bit value back to the database so records can be updated right
    from the datagrid. How can I do this? Can someone help me out?

    Thanks alot,
    REB
    REB, Mar 1, 2004
    #1
    1. Advertising

  2. REB

    REB Guest

    I discovered my error as to why I was getting repeating values from the
    checkbox, but still need some help on how to make a CheckChanged event for
    the checkbox in the datagrid so it will save to the database?

    Thanks,
    REB

    "REB" <> wrote in message
    news:uPb$Y96$...
    > I have a datagrid that retrieves 3 fields per record row from a SQL server
    > 2000 database table, the data it retrieves looks like this:
    >
    > Violation Notice Date Type of Violation
    > <True/False> 3/1/03 Speeding
    > <True/False> 2/10/04 Ran a stop light
    >
    > The <True/False> is a checkbox and signifies that we have received the
    > paperwork for the violation. Now onto my problems. First off I changed

    the
    > first column to a templated column and put in a checkbox and set its
    > databind text and checked propety to use the correct column from the data
    > source (source is a SQL bit column that only contains a 0 or a 1). This
    > worked, but only for the first row in the grid, each additional row would
    > show the same exact value from the first row. For example, I had 3

    records
    > and if the first one had a value of true all of them showed true even

    though
    > I verified that some were false. If I changed the first row to a false
    > value in SQL table then all rows show false.
    >
    > My second problem is when a checkbox is changed (CheckChanged event) I

    want
    > to save the bit value back to the database so records can be updated right
    > from the datagrid. How can I do this? Can someone help me out?
    >
    > Thanks alot,
    > REB
    >
    >
    REB, Mar 1, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. kannadasan
    Replies:
    1
    Views:
    1,003
  2. S. Justin Gengo

    Re: Checkboxes in a datagrid

    S. Justin Gengo, Aug 14, 2003, in forum: ASP .Net
    Replies:
    7
    Views:
    445
    S. Justin Gengo
    Aug 16, 2003
  3. Jos

    Re: CheckBoxes in Datagrid

    Jos, Aug 19, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    343
  4. DJ Dev
    Replies:
    7
    Views:
    661
    DJ Dev
    Feb 10, 2004
  5. Scott
    Replies:
    2
    Views:
    393
    Scott
    Aug 9, 2007
Loading...

Share This Page