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 Row Color

Data Grid Row Color

Scheduled Pinned Locked Moved ASP.NET
csshelpquestion
3 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.
  • N Offline
    N Offline
    NICE TO MEET
    wrote on last edited by
    #1

    for my requirement i want to change the colour of datagrid row by two colours alternatively, how can i achieve this requirement, also based on one column value yes or no, if no means i want to change the row colours please help for the two scenario Thanks in advance

    -

    S M 2 Replies Last reply
    0
    • N NICE TO MEET

      for my requirement i want to change the colour of datagrid row by two colours alternatively, how can i achieve this requirement, also based on one column value yes or no, if no means i want to change the row colours please help for the two scenario Thanks in advance

      -

      S Offline
      S Offline
      Sathesh Sakthivel
      wrote on last edited by
      #2

      Try with Code function myColor(){ var i = this.getRowProperty("index"); return obj_data[i][9]; } obj.getColumnTemplate(0).setStyle("color", myColor);

      Regards, Satips.

      1 Reply Last reply
      0
      • N NICE TO MEET

        for my requirement i want to change the colour of datagrid row by two colours alternatively, how can i achieve this requirement, also based on one column value yes or no, if no means i want to change the row colours please help for the two scenario Thanks in advance

        -

        M Offline
        M Offline
        Mayank Parmar
        wrote on last edited by
        #3

        Write this code in ItemDataBound Event ----------------------------- LinkButton lbd = (LinkButton)e.Item.FindControl("lbDLI"); if (e.Item.FindControl("lbDLI") != null) { if (DataBinder.Eval(e.Item.DataItem, "LIVE") != null) // Here LIVE is column name in database { int i = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "LIVE")); if (i == 0) { lbd.Text = "Idle"; } else { lbd.Font.Bold = true; lbd.ForeColor = Color.Green; lbd.Text = "Live"; } } }

        Regards, Mayank Parmar Senior Software Engineer Amba Tech Gandhinagar, India

        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