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. Convert int to bool while binding

Convert int to bool while binding

Scheduled Pinned Locked Moved ASP.NET
questionwpfwcfhelpannouncement
4 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.
  • E Offline
    E Offline
    error1408
    wrote on last edited by
    #1

    Hi, i have a table with an INT column. The value is either 0 or 1. (It is a flag). Now i'd like to bind it to an checkbox. 1 for checked. 0 for unchecked. I tried this: But i get an exception. How do i get this checkbox checked? (The update is no problem, i can convert the bool i get) Thank you.

    N T 2 Replies Last reply
    0
    • E error1408

      Hi, i have a table with an INT column. The value is either 0 or 1. (It is a flag). Now i'd like to bind it to an checkbox. 1 for checked. 0 for unchecked. I tried this: But i get an exception. How do i get this checkbox checked? (The update is no problem, i can convert the bool i get) Thank you.

      N Offline
      N Offline
      Naveed Kamboh
      wrote on last edited by
      #2

      Try to do it on DataBinding event of Check box. Hopefully it will work.

      Naveed Kamboh Complexity kills, Write easy code for your self. isolutionteam

      1 Reply Last reply
      0
      • E error1408

        Hi, i have a table with an INT column. The value is either 0 or 1. (It is a flag). Now i'd like to bind it to an checkbox. 1 for checked. 0 for unchecked. I tried this: But i get an exception. How do i get this checkbox checked? (The update is no problem, i can convert the bool i get) Thank you.

        T Offline
        T Offline
        tonyalex
        wrote on last edited by
        #3

        if it return only 0 and 1 then u can use the bool.parse() method,it will convert the value to bool, please check that

        E 1 Reply Last reply
        0
        • T tonyalex

          if it return only 0 and 1 then u can use the bool.parse() method,it will convert the value to bool, please check that

          E Offline
          E Offline
          error1408
          wrote on last edited by
          #4

          Ok i'll try it, but would you post an example how to integrate this method in my line? That's the biggest problem i have :-O

          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