Finding if an value exists in a DD list

Discussion in 'ASP .Net' started by Stu, May 20, 2004.

  1. Stu

    Stu Guest

    Hi,

    I have a web form that uses simple binding to bind properties to the
    controls on the page. However, if I try and bind a value to a dd list using:

    SelectedValue="<%# MyProperty %>"

    If the value doesn't exist it throws and error: Object reference not set to
    an instance of an object.
    Is there any way to test if a value exists in a DD list (preferably without
    looping through each item individually)?

    Thanks in advance,

    Stu
     
    Stu, May 20, 2004
    #1
    1. Advertising

  2. Stu:

    You shoudl wrap the binding code in a try catch block.


    "Stu" <> wrote in message
    news:...
    > Hi,
    >
    > I have a web form that uses simple binding to bind properties to the
    > controls on the page. However, if I try and bind a value to a dd list

    using:
    >
    > SelectedValue="<%# MyProperty %>"
    >
    > If the value doesn't exist it throws and error: Object reference not set

    to
    > an instance of an object.
    > Is there any way to test if a value exists in a DD list (preferably

    without
    > looping through each item individually)?
    >
    > Thanks in advance,
    >
    > Stu
    >
    >
     
    Elliot M. Rodriguez, MCSD, May 20, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stu
    Replies:
    4
    Views:
    7,224
    Kevin Spencer
    Aug 19, 2003
  2. Totan
    Replies:
    0
    Views:
    948
    Totan
    Apr 17, 2006
  3. Replies:
    2
    Views:
    440
    Eric Sosman
    Feb 5, 2007
  4. =?Utf-8?B?QnJlbmRlbiBCaXhsZXI=?=

    Dropdown List - Check if value exists in list prior to selection

    =?Utf-8?B?QnJlbmRlbiBCaXhsZXI=?=, Mar 10, 2007, in forum: ASP .Net
    Replies:
    5
    Views:
    1,991
    =?Utf-8?B?QnJlbmRlbg==?=
    Mar 20, 2007
  5. Ulf Meinhardt
    Replies:
    8
    Views:
    6,155
Loading...

Share This Page