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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. asp:CheckBox two-way binding problem

asp:CheckBox two-way binding problem

Scheduled Pinned Locked Moved ASP.NET
helpdatabasewpfwcftutorial
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.
  • F Offline
    F Offline
    FlorianS
    wrote on last edited by
    #1

    Hi I have a problem with binding parameters to an update command for an asp:SqlDataSource. The problem is when I am trying to bind a ASP:CheckBox field. I have this definition …………….

    --------- I am getting this error; Cannot insert the value NULL into column 'PrivateLivingArea', table 'RentalProperty.dbo.HomeListing'; column does not allow nulls. UPDATE fails. The statement has been terminated. I know what it means but I can not figure out how to bind this checkbox field to the query parameters

    M 1 Reply Last reply
    0
    • F FlorianS

      Hi I have a problem with binding parameters to an update command for an asp:SqlDataSource. The problem is when I am trying to bind a ASP:CheckBox field. I have this definition …………….

      --------- I am getting this error; Cannot insert the value NULL into column 'PrivateLivingArea', table 'RentalProperty.dbo.HomeListing'; column does not allow nulls. UPDATE fails. The statement has been terminated. I know what it means but I can not figure out how to bind this checkbox field to the query parameters

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      Hi there, The Eval method supports one-way (read-only) binding, here there are two options: + You can use the Bind method which supports two-way databinding instead of the Eval, you can read more about this in MSDN[^]. + You can create a handler for the Updating event of the SqlDataSource control, in the method you can query the value of the check box and pass it to the input paramaters of the command.

      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