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. CheckBox in a DataGrid?

CheckBox in a DataGrid?

Scheduled Pinned Locked Moved ASP.NET
questiondatabasehelptutorial
2 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.
  • C Offline
    C Offline
    chand10
    wrote on last edited by
    #1

    Hi In my application I got two columns,one is for Serial No. other one is for CheckBox. I have get value from DataBase and fill into this DataGrid,for Serial No. I have Interger column in DataGrid and for CheckBox Tinyint.For CheckBox column in DataGrid values r 0 and 1. My problem is that I have to get both the values simultaneously, if the value in CheckBox column is 1 then the CheckBox in the DataGrid should check,if it is 0 it should uncheck. How can I get Serial No. in one column and checking of CheckBoxes in another. What shuold I use for Getting values from DataBase; DataReader or DataSet Plz suggest me an example.

    I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

    N 1 Reply Last reply
    0
    • C chand10

      Hi In my application I got two columns,one is for Serial No. other one is for CheckBox. I have get value from DataBase and fill into this DataGrid,for Serial No. I have Interger column in DataGrid and for CheckBox Tinyint.For CheckBox column in DataGrid values r 0 and 1. My problem is that I have to get both the values simultaneously, if the value in CheckBox column is 1 then the CheckBox in the DataGrid should check,if it is 0 it should uncheck. How can I get Serial No. in one column and checking of CheckBoxes in another. What shuold I use for Getting values from DataBase; DataReader or DataSet Plz suggest me an example.

      I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

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

      After binding grid, you can iterate through the grid rows by checking your condition. If your condition satisfies, get the checkbox id and check it. Or you can use ItemDatabound event for datagrid. Datagrid will fire this event when each row created. In this event you can take serial number from datagrid, do a select to your table and check the checkbox depends on value.

      chand10 wrote:

      What shuold I use for Getting values from DataBase; DataReader or DataSet

      I prefer DataSet


      My Website | Ask smart questions

      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