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. General Programming
  3. C#
  4. DataGrid

DataGrid

Scheduled Pinned Locked Moved C#
4 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.
  • I Offline
    I Offline
    ImanMahmoud
    wrote on last edited by
    #1

    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"

    H I 2 Replies Last reply
    0
    • I ImanMahmoud

      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"

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      The DataGrid is only a view of the data. The best place to query this information is from the data that's bound to the DataGrid. This greatly depends on the underlying data store. If you're using a DataSet or DataTable, enumerate the DataRows 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 the DataSource (and, optionally, DataMember) properties of the DataGrid, you need to get back (cast the DataSource property to whatever type you assigned to it originally) and enumerate. If you used some other IList or IListSource implementation, you need to do roughly the same thing. No one can really help you further without knowing what you bound to the DataGrid. Even using the BindingContext property requires knowledge of what type of data store you bound so one can know which BindingManagerBase 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]

      1 Reply Last reply
      0
      • I ImanMahmoud

        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 Offline
        I Offline
        ImanMahmoud
        wrote on last edited by
        #3

        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

        S 1 Reply Last reply
        0
        • I ImanMahmoud

          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

          S Offline
          S Offline
          sreejith ss nair
          wrote on last edited by
          #4

          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 **************************

          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