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. Set css class of a TR in c# code

Set css class of a TR in c# code

Scheduled Pinned Locked Moved ASP.NET
csharpcsssysadmin
4 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.
  • K Offline
    K Offline
    Khawar Abbas1
    wrote on last edited by
    #1

    I want to set the css class of a Table row in a c# code. The TR attribut is set to runnat="server".

    Do good and have good.

    C 1 Reply Last reply
    0
    • K Khawar Abbas1

      I want to set the css class of a Table row in a c# code. The TR attribut is set to runnat="server".

      Do good and have good.

      C Offline
      C Offline
      Chetan Ranpariya
      wrote on last edited by
      #2

      Hi, r.CssClass = "sss"; Where "r" is and object of TableRow class. I hope this wil help u.

      Thanks and Regards, Chetan Ranpariya

      K 1 Reply Last reply
      0
      • C Chetan Ranpariya

        Hi, r.CssClass = "sss"; Where "r" is and object of TableRow class. I hope this wil help u.

        Thanks and Regards, Chetan Ranpariya

        K Offline
        K Offline
        Khawar Abbas1
        wrote on last edited by
        #3

        But i m using HTML table and it doesnot give CssClass property in C# file[code behind]

        Do good and have good.

        C 1 Reply Last reply
        0
        • K Khawar Abbas1

          But i m using HTML table and it doesnot give CssClass property in C# file[code behind]

          Do good and have good.

          C Offline
          C Offline
          Chetan Ranpariya
          wrote on last edited by
          #4

          Hi, You can do this by following. tbl1.Rows[rowindex].Attributes["class"] = "cssclassname"; here "tbl1" is the id of your HTMLTable and "rowindex" is the index of row in that table. I hope this will help you.

          Thanks and Regards, Chetan Ranpariya

          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