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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. applying css by coding in Gridview

applying css by coding in Gridview

Scheduled Pinned Locked Moved ASP.NET
cssquestion
5 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.
  • P Offline
    P Offline
    Prashant B Lavate
    wrote on last edited by
    #1

    hello......i want to apply css to cell which is of HyperLink Filed type i have written this code ... css is not applyin so whats wrong in this code? protected void gvMessagges_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowIndex >= 0) { if (Convert.ToBoolean(e.Row.Cells[5].Text.ToString())) { e.Row.Cells[3].CssClass = "AgentMessageTrue"; } else { e.Row.Cells[3].CssClass = "AgentMessageFalse"; } } }

    Thanks & Regards, Prashant B. Lavate Software Engineer Mobile : +919423872257 Pune(India)

    N N 2 Replies Last reply
    0
    • P Prashant B Lavate

      hello......i want to apply css to cell which is of HyperLink Filed type i have written this code ... css is not applyin so whats wrong in this code? protected void gvMessagges_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowIndex >= 0) { if (Convert.ToBoolean(e.Row.Cells[5].Text.ToString())) { e.Row.Cells[3].CssClass = "AgentMessageTrue"; } else { e.Row.Cells[3].CssClass = "AgentMessageFalse"; } } }

      Thanks & Regards, Prashant B. Lavate Software Engineer Mobile : +919423872257 Pune(India)

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      1 - Check styles are referred correctly 2 - Check page source to see the class attribute is added to the row.

      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

      P 1 Reply Last reply
      0
      • N N a v a n e e t h

        1 - Check styles are referred correctly 2 - Check page source to see the class attribute is added to the row.

        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

        P Offline
        P Offline
        Prashant B Lavate
        wrote on last edited by
        #3

        i am not getting it navneet will u tell me in brief.

        Thanks & Regards, Prashant B. Lavate Software Engineer Mobile : +919423872257 Pune(India)

        N 1 Reply Last reply
        0
        • P Prashant B Lavate

          i am not getting it navneet will u tell me in brief.

          Thanks & Regards, Prashant B. Lavate Software Engineer Mobile : +919423872257 Pune(India)

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          I was pointing some chances that may stop CSS functioning. Is all that OK in your case ?

          All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

          1 Reply Last reply
          0
          • P Prashant B Lavate

            hello......i want to apply css to cell which is of HyperLink Filed type i have written this code ... css is not applyin so whats wrong in this code? protected void gvMessagges_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowIndex >= 0) { if (Convert.ToBoolean(e.Row.Cells[5].Text.ToString())) { e.Row.Cells[3].CssClass = "AgentMessageTrue"; } else { e.Row.Cells[3].CssClass = "AgentMessageFalse"; } } }

            Thanks & Regards, Prashant B. Lavate Software Engineer Mobile : +919423872257 Pune(India)

            N Offline
            N Offline
            Nouman Bhatti
            wrote on last edited by
            #5

            I think the event in which you write your code must be raised after page_initialization or page load event that's why this code doesn't have any affect

            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