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. datagrid with checkboxes

datagrid with checkboxes

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasehelpquestion
3 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.
  • R Offline
    R Offline
    rameshdontagani
    wrote on last edited by
    #1

    i have a datagrid ..in that two columns are there ....seats.and checkboxes i am getting the seats value from the database... my problem is if the seats value is more tha 0 ..then only the checkbox should be visible... if the value is lessthan or equal to 0 ..then the checkbox should be invisible how can i do this in asp.net

    C R 2 Replies Last reply
    0
    • R rameshdontagani

      i have a datagrid ..in that two columns are there ....seats.and checkboxes i am getting the seats value from the database... my problem is if the seats value is more tha 0 ..then only the checkbox should be visible... if the value is lessthan or equal to 0 ..then the checkbox should be invisible how can i do this in asp.net

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      By setting the visible property on both controls, and putting them in one column, which is also dynamically named.

      Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      1 Reply Last reply
      0
      • R rameshdontagani

        i have a datagrid ..in that two columns are there ....seats.and checkboxes i am getting the seats value from the database... my problem is if the seats value is more tha 0 ..then only the checkbox should be visible... if the value is lessthan or equal to 0 ..then the checkbox should be invisible how can i do this in asp.net

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

        Use the GridView.RowDataBound Event and for each new generated row check the seats value (e.Rows.Cells[0].Text) and change the checkbox visibility accordingly. e.Rows.Cells[1].FindControl(checkbox)....

        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