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. Problem with two images!

Problem with two images!

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

    I have two Images that are in Itemtemplate one is sad.gif then the other is laughing.gif. then in EditItemTemplate is a RadioButtonList with two RadioButtons Good Mood and Bad Mood. all are in the same column. This is how it is supposed to work when Good Mood is selected, and insert button is pressed, the image laughing.gif is to be chosen. This code was supposed to work but I don't understand why it's not working: But whether I select Good Mood or Bad Mood only the image laughing.gif is selected. Where could I be going wrong? Thanks

    G 1 Reply Last reply
    0
    • N nclauder

      I have two Images that are in Itemtemplate one is sad.gif then the other is laughing.gif. then in EditItemTemplate is a RadioButtonList with two RadioButtons Good Mood and Bad Mood. all are in the same column. This is how it is supposed to work when Good Mood is selected, and insert button is pressed, the image laughing.gif is to be chosen. This code was supposed to work but I don't understand why it's not working: But whether I select Good Mood or Bad Mood only the image laughing.gif is selected. Where could I be going wrong? Thanks

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      I think that the problem is that the Eval method returns a value of type Object, and when you compare that to a string, it will compare them as objects, not as strings. Even if they have the same value, they are not the same object, so the comparison always fails. Try casting the value from Eval into String.

      --- single minded; short sighted; long gone;

      N 2 Replies Last reply
      0
      • G Guffa

        I think that the problem is that the Eval method returns a value of type Object, and when you compare that to a string, it will compare them as objects, not as strings. Even if they have the same value, they are not the same object, so the comparison always fails. Try casting the value from Eval into String.

        --- single minded; short sighted; long gone;

        N Offline
        N Offline
        nclauder
        wrote on last edited by
        #3

        Thanks Guffa It has worked. This is how it worked I had to select Bad Mood By default and the code would be: Thanks a lot.

        1 Reply Last reply
        0
        • G Guffa

          I think that the problem is that the Eval method returns a value of type Object, and when you compare that to a string, it will compare them as objects, not as strings. Even if they have the same value, they are not the same object, so the comparison always fails. Try casting the value from Eval into String.

          --- single minded; short sighted; long gone;

          N Offline
          N Offline
          nclauder
          wrote on last edited by
          #4

          Why is it that when I insert data I fast get an error : Specified cast is not valid. But When I run it the second time I find the data was saved the right image was selected! Actually I can say every thing works well apart that when I atempt to insert data this error appears: Specified cast is not valid. on line: . Thanks

          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