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. Data Grid properties- SOS

Data Grid properties- SOS

Scheduled Pinned Locked Moved C#
csharpcss
3 Posts 2 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.
  • S Offline
    S Offline
    Scorpio
    wrote on last edited by
    #1

    Can I change the color of perticular cell in C# for DataGrid control. I want to change the color of the cells which have numeric value below 100.

    Z 1 Reply Last reply
    0
    • S Scorpio

      Can I change the color of perticular cell in C# for DataGrid control. I want to change the color of the cells which have numeric value below 100.

      Z Offline
      Z Offline
      ZuhaiB 0
      wrote on last edited by
      #2

      foreach (GridViewRow row in GridView1.Rows) { long cellValue = long.Parse(row.Cells[1].Text.ToString()); if (cellValue > 100) { row.Cells[1].BackColor = System.Drawing.Color.Red; row.Cells[1].ForeColor = System.Drawing.Color.Blue; } } Here Cells[1] 1 should be the index of the Column that you want to compare. for(int i=0;i<500;i++) Console.WriteLine("I Love C# \n");

      S 1 Reply Last reply
      0
      • Z ZuhaiB 0

        foreach (GridViewRow row in GridView1.Rows) { long cellValue = long.Parse(row.Cells[1].Text.ToString()); if (cellValue > 100) { row.Cells[1].BackColor = System.Drawing.Color.Red; row.Cells[1].ForeColor = System.Drawing.Color.Blue; } } Here Cells[1] 1 should be the index of the Column that you want to compare. for(int i=0;i<500;i++) Console.WriteLine("I Love C# \n");

        S Offline
        S Offline
        Scorpio
        wrote on last edited by
        #3

        But I am not using any WEB page , can I use (GridViewRow control ) for the desktop application aswell.

        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