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. Gridview

Gridview

Scheduled Pinned Locked Moved ASP.NET
csshelp
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.
  • M Offline
    M Offline
    Murugavel Sadagopan
    wrote on last edited by
    #1

    Hi All, I develop a application with grid view. I have bind the values in gridview view (5 records). in Gridview, I want 4th row in red color and 5th row in green color. Plz help me. Thanks, Murugavel s

    D S 2 Replies Last reply
    0
    • M Murugavel Sadagopan

      Hi All, I develop a application with grid view. I have bind the values in gridview view (5 records). in Gridview, I want 4th row in red color and 5th row in green color. Plz help me. Thanks, Murugavel s

      D Offline
      D Offline
      Dineshshp
      wrote on last edited by
      #2

      You can do it on RowDataBound Event. Like This :

      protected void Grd_RowDataBound(object sender, GridViewRowEventArgs e)
      {
      try
      {
      if (e.Row.RowType == DataControlRowType.DataRow && e.Row.RowIndex == 4)
      {
      e.Row.Style["Color"] = "Red";
      }
      else if (e.Row.RowType == DataControlRowType.DataRow && e.Row.RowIndex == 5)
      {
      e.Row.Style["Color"] = "Green";
      }

      }
      

      }

      1 Reply Last reply
      0
      • M Murugavel Sadagopan

        Hi All, I develop a application with grid view. I have bind the values in gridview view (5 records). in Gridview, I want 4th row in red color and 5th row in green color. Plz help me. Thanks, Murugavel s

        S Offline
        S Offline
        Sandeep Mewara
        wrote on last edited by
        #3

        Read about gridview event RowDataBound You get access to grid's row at the time of bind. Based on the need, you can set styles and make changes in row. Try out.

        Sandeep Mewara Microsoft ASP.NET MVP 2012 & 2013 [My Latest Post(s)]: My Blog Server side Delimiters in ASP.NET How to extend a WPF Textbox to Custom Picker

        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