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. General Programming
  3. C#
  4. Checkbox column in a grid view...

Checkbox column in a grid view...

Scheduled Pinned Locked Moved C#
csharpcssasp-net
3 Posts 3 Posters 1 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.
  • D Offline
    D Offline
    Dotnetkanna
    wrote on last edited by
    #1

    Hi everyone, Im using c# asp.net 2.0. In a dataset im having one column value as either 0 or 1,if the row value is 1 means the checkbox should be checked and its 0 means the checkbox should be unchecked in the gridview,im having the checkbox column as a template column.im having one checkbox column.How should i achieve this.. regards Kanna..

    M R 2 Replies Last reply
    0
    • D Dotnetkanna

      Hi everyone, Im using c# asp.net 2.0. In a dataset im having one column value as either 0 or 1,if the row value is 1 means the checkbox should be checked and its 0 means the checkbox should be unchecked in the gridview,im having the checkbox column as a template column.im having one checkbox column.How should i achieve this.. regards Kanna..

      M Offline
      M Offline
      Michael Sync
      wrote on last edited by
      #2

      Put one more label in this checkbox column. the DataField of this label should be mapped to the actual field from database. In Item_DataBound() event of GridView, you can check whether the value is 0 or 1. then, find the checked box control and check or uncheck based on the value.. Eg: Item_DataBound Event Label lbl = (Label)e.FindControl("lblValue"); CheckedBox chk = (CheckedBox)e.FindControl("chkCheckedBox"); chk = (lbl.Text == "1") ?? true:false;

      Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)

      1 Reply Last reply
      0
      • D Dotnetkanna

        Hi everyone, Im using c# asp.net 2.0. In a dataset im having one column value as either 0 or 1,if the row value is 1 means the checkbox should be checked and its 0 means the checkbox should be unchecked in the gridview,im having the checkbox column as a template column.im having one checkbox column.How should i achieve this.. regards Kanna..

        R Offline
        R Offline
        Revathij
        wrote on last edited by
        #3

        just bind data as other columns. But the Column u want to be in checkbox should be of datatype 'Bit' in database.

        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