DataGrid
-
I have a datagrid, all of its columns are bool columns. According to a specified condition I colored some of the datagrid cells. I want to return the colored cells that have a value = "false" when I click the button "OK"
-
I have a datagrid, all of its columns are bool columns. According to a specified condition I colored some of the datagrid cells. I want to return the colored cells that have a value = "false" when I click the button "OK"
The
DataGrid
is only a view of the data. The best place to query this information is from the data that's bound to theDataGrid
. This greatly depends on the underlying data store. If you're using aDataSet
orDataTable
, enumerate theDataRow
s and with each row enumerate the fields. What you do with this data is specific to your implementation and requirements. So, whatever you bound to theDataSource
(and, optionally,DataMember
) properties of theDataGrid
, you need to get back (cast theDataSource
property to whatever type you assigned to it originally) and enumerate. If you used some otherIList
orIListSource
implementation, you need to do roughly the same thing. No one can really help you further without knowing what you bound to theDataGrid
. Even using theBindingContext
property requires knowledge of what type of data store you bound so one can know whichBindingManagerBase
derivative to refer to. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] -
I have a datagrid, all of its columns are bool columns. According to a specified condition I colored some of the datagrid cells. I want to return the colored cells that have a value = "false" when I click the button "OK"
i am sory, my problem explaination was not enough at all. first, i bound a DataTable to my DataGrid. my problem is: i have a TreeView in the same form of the dataGrid. 1. According to a specified condition I colored some of the datagrid cells (i color only the left section from the cell (assume red)). 2. For each TreeNode in this TreeView i make the value of some datagrid cells to be "true", in addition, i color the right section from this cell (assume green). In the event treeView1_AfterSelect, i empty the DataTable to receive a new data for the new TreeNode. When i do this the color of the right section (green color) is alse deleted. a) I want to keep this (green) color to be seen along all TreeNodes selection to ensure unique data selection (or no data is selected towice) for different treeNodes. b) in addition, i want to return the cells that have a "false" value and a red color thanks alot
-
i am sory, my problem explaination was not enough at all. first, i bound a DataTable to my DataGrid. my problem is: i have a TreeView in the same form of the dataGrid. 1. According to a specified condition I colored some of the datagrid cells (i color only the left section from the cell (assume red)). 2. For each TreeNode in this TreeView i make the value of some datagrid cells to be "true", in addition, i color the right section from this cell (assume green). In the event treeView1_AfterSelect, i empty the DataTable to receive a new data for the new TreeNode. When i do this the color of the right section (green color) is alse deleted. a) I want to keep this (green) color to be seen along all TreeNodes selection to ensure unique data selection (or no data is selected towice) for different treeNodes. b) in addition, i want to return the cells that have a "false" value and a red color thanks alot
hi, What heath says is correct. And here i can give one more solution that is datagrid tablestyle. You can check my datagrid related article. There i mentioned rich usage of DataGridTableStyle class.;) ************************** S r e e j i t h N a i r **************************