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 values in Repeater Control

Checkbox values in Repeater Control

Scheduled Pinned Locked Moved ASP.NET
help
3 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.
  • B Offline
    B Offline
    Baatezu
    wrote on last edited by
    #1

    I'm trying to set the Checked value in a checkbox inside a repeater control. The code I am using for this is I am getting a 'Specified cast is not valid.' error when I run this. When filling the 'Active' Column in the dataset I have tried both using a string "True" and a boolean true to attempt to set the value. I get the same error both ways. Everything I can find online shows that this is the right method to do this, but I am unable to resolve this error. Any pointers on this would be very appreciated. The wisest of the wise may err. - Aeschylus -- modified at 3:33 Sunday 13th November, 2005

    C 1 Reply Last reply
    0
    • B Baatezu

      I'm trying to set the Checked value in a checkbox inside a repeater control. The code I am using for this is I am getting a 'Specified cast is not valid.' error when I run this. When filling the 'Active' Column in the dataset I have tried both using a string "True" and a boolean true to attempt to set the value. I get the same error both ways. Everything I can find online shows that this is the right method to do this, but I am unable to resolve this error. Any pointers on this would be very appreciated. The wisest of the wise may err. - Aeschylus -- modified at 3:33 Sunday 13th November, 2005

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

      Baatezu wrote:

      DataBinder.Eval(Container, "DataItem.Active")

      I would change this to use ? : notation to return the string true or false, based on the result of DataBinder.Eval. Christian Graus - Microsoft MVP - C++

      D 1 Reply Last reply
      0
      • C Christian Graus

        Baatezu wrote:

        DataBinder.Eval(Container, "DataItem.Active")

        I would change this to use ? : notation to return the string true or false, based on the result of DataBinder.Eval. Christian Graus - Microsoft MVP - C++

        D Offline
        D Offline
        Daniel Santillanes
        wrote on last edited by
        #3

        Yep, that's actually the problem... when the code snippet is executed, what happens is that it tries to write a string out of a boolean without a proper type cast. so you can either make: DataBinder.Eval(Container, "DataItem.Active").ToString(); or what Christian says: (DataBinder.Eval(Container, "DataItem.Active") ? "True" : "False") daniero

        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