Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Allow to Check only one checkbox at a time in the datagrid

Allow to Check only one checkbox at a time in the datagrid

Scheduled Pinned Locked Moved ASP.NET
csharpquestionannouncement
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BORN again
    wrote on last edited by
    #1

    Hello, I have a databound datagrid with vehicle driver details. I add new/blank rows to this datagrid on a button click event to insert new record to the driver table and also have the edit/update functionality. One of the columns is 'Current Driver?' which is also databound in a template column. Since there can be only one current driver for a vehicle at a given point of time, on checking the 'current driver' checkbox I need to write an itemdatabound event for the datagrid which will allow me to check only one checkbox. I do not want any messages to popup, all I want is if a person checks this checkbox for a record then it should be allowed but previously checked checkbox for any other records should be unchecked automatically so that any given point only record has the 'current driver' status checked. Is there any way to achieve this? I use VS2005Pro/.net2.0/VB Thanks a ton.

    Aartee. ...HE is watching Us All!

    S V 2 Replies Last reply
    0
    • B BORN again

      Hello, I have a databound datagrid with vehicle driver details. I add new/blank rows to this datagrid on a button click event to insert new record to the driver table and also have the edit/update functionality. One of the columns is 'Current Driver?' which is also databound in a template column. Since there can be only one current driver for a vehicle at a given point of time, on checking the 'current driver' checkbox I need to write an itemdatabound event for the datagrid which will allow me to check only one checkbox. I do not want any messages to popup, all I want is if a person checks this checkbox for a record then it should be allowed but previously checked checkbox for any other records should be unchecked automatically so that any given point only record has the 'current driver' status checked. Is there any way to achieve this? I use VS2005Pro/.net2.0/VB Thanks a ton.

      Aartee. ...HE is watching Us All!

      S Offline
      S Offline
      Sylvester george
      wrote on last edited by
      #2

      Checkbox is meant to be multiple selections. Yet you can do it thru codings. But radio button is the best control in this scenario. So use radio buttons and set the groupname property as common name.

      Regards, Sylvester G sylvester_g_m@yahoo.com

      1 Reply Last reply
      0
      • B BORN again

        Hello, I have a databound datagrid with vehicle driver details. I add new/blank rows to this datagrid on a button click event to insert new record to the driver table and also have the edit/update functionality. One of the columns is 'Current Driver?' which is also databound in a template column. Since there can be only one current driver for a vehicle at a given point of time, on checking the 'current driver' checkbox I need to write an itemdatabound event for the datagrid which will allow me to check only one checkbox. I do not want any messages to popup, all I want is if a person checks this checkbox for a record then it should be allowed but previously checked checkbox for any other records should be unchecked automatically so that any given point only record has the 'current driver' status checked. Is there any way to achieve this? I use VS2005Pro/.net2.0/VB Thanks a ton.

        Aartee. ...HE is watching Us All!

        V Offline
        V Offline
        Vasudevan Deepak Kumar
        wrote on last edited by
        #3

        Use radio or have a JavaScript function to uncheck.

        Vasudevan Deepak Kumar Personal Homepage Tech Gossips

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups