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. Web Development
  3. ASP.NET
  4. Data Grid Coloured Cell..

Data Grid Coloured Cell..

Scheduled Pinned Locked Moved ASP.NET
csharpcssasp-netdatabase
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.
  • P Offline
    P Offline
    Pradhip
    wrote on last edited by
    #1

    Hi: I have a datagrid that displays two columns say fruit name,fruit colour from the database..The fruit colour columns is rendered invisible. What do i do to make the font colour on the datagrid cell that displays fruit name as the colour specified in the "fruit colour column" for eg: if i have apple red then the cell displaying apple must be haveing red font.. This project is done on asp.net,VB.NET,windows xp platform,IE 6.0. Thanks in advance for the help. Regards Pradhip.S If Fed-EX and UPS merged whats the new company called--FedUp??

    N 1 Reply Last reply
    0
    • P Pradhip

      Hi: I have a datagrid that displays two columns say fruit name,fruit colour from the database..The fruit colour columns is rendered invisible. What do i do to make the font colour on the datagrid cell that displays fruit name as the colour specified in the "fruit colour column" for eg: if i have apple red then the cell displaying apple must be haveing red font.. This project is done on asp.net,VB.NET,windows xp platform,IE 6.0. Thanks in advance for the help. Regards Pradhip.S If Fed-EX and UPS merged whats the new company called--FedUp??

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      Pradhip wrote: VB.NET First step is to stop using VB. X| You need to override the OnItemCreated method of the datagrid. private void OnItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { if( e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem ) e.Item.Cells[FruitCell].BackColor = Color.FromName(e.Item.Cells[ColorCell].Text); }

      P 1 Reply Last reply
      0
      • N Not Active

        Pradhip wrote: VB.NET First step is to stop using VB. X| You need to override the OnItemCreated method of the datagrid. private void OnItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { if( e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem ) e.Item.Cells[FruitCell].BackColor = Color.FromName(e.Item.Cells[ColorCell].Text); }

        P Offline
        P Offline
        Pradhip
        wrote on last edited by
        #3

        Thanks Mark: Your Code Worked cool.And there is also an article on www.pinnaclepublishing.com(check out on asp.net) for the november month that discusses the ItemDataBoundEvent in detail.. Link for the article:-http://www.pinnaclepublishing.com/activeweb/AWmag.nsf/0/F1D90C2E7F032EE785256C6F005E6B15 Regards Pradhip.S If a Building is Completed then why do they call it BUILDING ??

        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