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
questionhelp
4 Posts 4 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.
  • J Offline
    J Offline
    jainiraj
    wrote on last edited by
    #1

    I have a gridview with autogeneratecolumn false.I have bind it with a data table dt.In dt there is a column named as "status" whose data type i bit.that means status can take either 0 or1.in gridview this column shows true or false. I want to show "Read" and "Unread" for 0,1 respectively. How can I do??? plz..help...

    B T A 3 Replies Last reply
    0
    • J jainiraj

      I have a gridview with autogeneratecolumn false.I have bind it with a data table dt.In dt there is a column named as "status" whose data type i bit.that means status can take either 0 or1.in gridview this column shows true or false. I want to show "Read" and "Unread" for 0,1 respectively. How can I do??? plz..help...

      B Offline
      B Offline
      Baran M
      wrote on last edited by
      #2

      In GridView1_RowDataBound(), try this, if (e.Row.Cells[1].Text == "0") { e.Row.Cells[1].Text = "Read"; }

      1 Reply Last reply
      0
      • J jainiraj

        I have a gridview with autogeneratecolumn false.I have bind it with a data table dt.In dt there is a column named as "status" whose data type i bit.that means status can take either 0 or1.in gridview this column shows true or false. I want to show "Read" and "Unread" for 0,1 respectively. How can I do??? plz..help...

        T Offline
        T Offline
        Tuwing Sabado
        wrote on last edited by
        #3

        Use the GridView RowDataBound Event Delegate to change the value of one cell. protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { e.Row.Cells[0].Text = e.Row.Cells[0].Text == "0" ? "Unread" : "Read"; } Happy Coding...

        1 Reply Last reply
        0
        • J jainiraj

          I have a gridview with autogeneratecolumn false.I have bind it with a data table dt.In dt there is a column named as "status" whose data type i bit.that means status can take either 0 or1.in gridview this column shows true or false. I want to show "Read" and "Unread" for 0,1 respectively. How can I do??? plz..help...

          A Offline
          A Offline
          ais07
          wrote on last edited by
          #4

          You can also use case in query at time of retrieving data from database :- For Example:- case status when '0' then 'Unread' else 'Read' end as status

          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