selecteditem.value vs. selectedvalue

Discussion in 'ASP .Net' started by darrel, Aug 9, 2005.

  1. darrel

    darrel Guest

    what is the difference between these? I always end up typing 'selectedvalue'
    only to have problems and then realize I meant to use selecteditem.value
    (the value of the selected item).

    When would one use the former (selectedValue)?

    -Darrel
     
    darrel, Aug 9, 2005
    #1
    1. Advertisements

  2. darrel

    Lucas Tam Guest


    It just saves a step ; )
     
    Lucas Tam, Aug 9, 2005
    #2
    1. Advertisements

  3. darrel

    darrel Guest

    what is the difference between these? I always end up typing
    So they are actually the same thing? Odd. I had problems with one but not
    the other recently. I'll have to go back and figure out what the culprit
    was...

    -Darrel
     
    darrel, Aug 9, 2005
    #3
  4. darrel

    Bruce Barker Guest

    SelectedValues returns the Value of the selecteditem or "" if there is none.

    SelectedItem returns the selected item. SelectedItem.Value return the .Value
    of the SelectedItem. SelectedItem.Value will throw an error if there is no
    selected item, because SelectedItem will return null, and .Value of null
    will throw the error.

    -- bruce (sqlwork.com)
     
    Bruce Barker, Aug 10, 2005
    #4
  5. darrel

    darrel Guest

    SelectedItem returns the selected item. SelectedItem.Value return the
    ..Value
    aha! That explains the issues I was having. Thanks for that clarification!

    -Darrel
     
    darrel, Aug 10, 2005
    #5
  6. darrel

    Rustykool

    Joined:
    Jan 24, 2013
    Messages:
    1
    Likes Received:
    0
    I agree with Darrel,that's exactly what it means...
     
    Rustykool, Jan 24, 2013
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.