J
Jerry
I need to use the DataGrid control to display rows from a SQL table and also
show a checkbox that the user can click on to select different rows. I add a
Boolean DataColumn to the table and then assign it to the datagrid. I can
click on the checkbox and change the value, but when I click on another row
it errors out with that the column is read-only and asks if I want to
correct it. It won't let me change the value. If I use the SQL statement to
add the column as a constant of datatype 'bit' and a value of -1 then it
errors out with an invalid typecast error.
Here is the code where I create a new Boolean DataColumn and add it to the
table. This should be standard stuff, but I can't get anything to work. Any
suggestions?
------------------------------
SQL = "SELECT * FROM tblAnimalFacility";
DataColumn dc = new DataColumn("PrintCard",
System.Type.GetType("System.Boolean"),"-1");
ds =
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteDataset(CommandType.Text,S
QL);
ds.Tables[0].Columns.Add(dc);
grdPurchases.DataSource = ds.Tables[0];
show a checkbox that the user can click on to select different rows. I add a
Boolean DataColumn to the table and then assign it to the datagrid. I can
click on the checkbox and change the value, but when I click on another row
it errors out with that the column is read-only and asks if I want to
correct it. It won't let me change the value. If I use the SQL statement to
add the column as a constant of datatype 'bit' and a value of -1 then it
errors out with an invalid typecast error.
Here is the code where I create a new Boolean DataColumn and add it to the
table. This should be standard stuff, but I can't get anything to work. Any
suggestions?
------------------------------
SQL = "SELECT * FROM tblAnimalFacility";
DataColumn dc = new DataColumn("PrintCard",
System.Type.GetType("System.Boolean"),"-1");
ds =
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteDataset(CommandType.Text,S
QL);
ds.Tables[0].Columns.Add(dc);
grdPurchases.DataSource = ds.Tables[0];