CheckBox in a DataGrid?
-
Hi In my application I got two columns,one is for Serial No. other one is for CheckBox. I have get value from DataBase and fill into this DataGrid,for Serial No. I have Interger column in DataGrid and for CheckBox Tinyint.For CheckBox column in DataGrid values r 0 and 1. My problem is that I have to get both the values simultaneously, if the value in CheckBox column is 1 then the CheckBox in the DataGrid should check,if it is 0 it should uncheck. How can I get Serial No. in one column and checking of CheckBoxes in another. What shuold I use for Getting values from DataBase; DataReader or DataSet Plz suggest me an example.
I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu
-
Hi In my application I got two columns,one is for Serial No. other one is for CheckBox. I have get value from DataBase and fill into this DataGrid,for Serial No. I have Interger column in DataGrid and for CheckBox Tinyint.For CheckBox column in DataGrid values r 0 and 1. My problem is that I have to get both the values simultaneously, if the value in CheckBox column is 1 then the CheckBox in the DataGrid should check,if it is 0 it should uncheck. How can I get Serial No. in one column and checking of CheckBoxes in another. What shuold I use for Getting values from DataBase; DataReader or DataSet Plz suggest me an example.
I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu
After binding grid, you can iterate through the grid rows by checking your condition. If your condition satisfies, get the checkbox id and check it. Or you can use ItemDatabound event for datagrid. Datagrid will fire this event when each row created. In this event you can take serial number from datagrid, do a select to your table and check the checkbox depends on value.
chand10 wrote:
What shuold I use for Getting values from DataBase; DataReader or DataSet
I prefer DataSet