Allow to Check only one checkbox at a time in the datagrid
-
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!
-
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!
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
-
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!
Use radio or have a JavaScript function to uncheck.
Vasudevan Deepak Kumar Personal Homepage Tech Gossips