Any good solutions for: SelectedValue which is invalid because it does not exist in the list of item

Discussion in 'ASP .Net' started by randy.buchholz, Jul 14, 2008.

  1. Just trying to get multiple dropdowns's to work inside another control
    (details view)
    I'm seeing this error, but not consistantly. I can even cut and paste a
    working set of controls into a new page, and somtimes it works and other
    times it throws this error.

    I'm sure this has come up before but I didn't see it in the history. Also,
    the solutions I have found on the web are pretty old.
    This is driving me crazy.
    randy.buchholz, Jul 14, 2008
    #1
    1. Advertising

  2. Make sure that every ddl has its own collection of items. Even if the items
    are the same, you need to have a separate copy of them for every ddl.

    It may be not the culprit in your case, hard to say without seeing the code.

    --
    Eliyahu Goldin,
    Software Developer
    Microsoft MVP [ASP.NET]
    http://msmvps.com/blogs/egoldin


    "randy.buchholz" <> wrote in message
    news:%...
    > Just trying to get multiple dropdowns's to work inside another control
    > (details view)
    > I'm seeing this error, but not consistantly. I can even cut and paste a
    > working set of controls into a new page, and somtimes it works and other
    > times it throws this error.
    >
    > I'm sure this has come up before but I didn't see it in the history.
    > Also, the solutions I have found on the web are pretty old.
    > This is driving me crazy.
    >
    Eliyahu Goldin, Jul 14, 2008
    #2
    1. Advertising

  3. Thanks Eliyahu,
    Would have put code if there was any not generated. It can be reproduced
    through dragging and dropping.
    I put a details view on the page, convert several fields to template fields
    and start adding databound ddl's to the fields. When I add new ddl and run
    the page it will work. As I continue to add ddl's at some point it throws
    the error. Once this eror shows, even if I remove the last (or other) ddl
    (returing to a previously working state) the error persists.

    Confirmed every ddl had its own source/dataset.

    "Eliyahu Goldin" <> wrote in
    message news:...
    > Make sure that every ddl has its own collection of items. Even if the
    > items are the same, you need to have a separate copy of them for every
    > ddl.
    >
    > It may be not the culprit in your case, hard to say without seeing the
    > code.
    >
    > --
    > Eliyahu Goldin,
    > Software Developer
    > Microsoft MVP [ASP.NET]
    > http://msmvps.com/blogs/egoldin
    >
    >
    > "randy.buchholz" <> wrote in message
    > news:%...
    >> Just trying to get multiple dropdowns's to work inside another control
    >> (details view)
    >> I'm seeing this error, but not consistantly. I can even cut and paste a
    >> working set of controls into a new page, and somtimes it works and other
    >> times it throws this error.
    >>
    >> I'm sure this has come up before but I didn't see it in the history.
    >> Also, the solutions I have found on the web are pretty old.
    >> This is driving me crazy.
    >>

    >
    randy.buchholz, Jul 15, 2008
    #3
  4. Analyze carefully the sequence of events. See when the ddls get populated
    and when the code is attempting to use the selected value. The likely reason
    for the exception is the code wants the value before the ddls get their
    items.

    --
    Eliyahu Goldin,
    Software Developer
    Microsoft MVP [ASP.NET]
    http://msmvps.com/blogs/egoldin
    http://usableasp.net


    "randy.buchholz" <> wrote in message
    news:...
    > Thanks Eliyahu,
    > Would have put code if there was any not generated. It can be reproduced
    > through dragging and dropping.
    > I put a details view on the page, convert several fields to template
    > fields and start adding databound ddl's to the fields. When I add new ddl
    > and run the page it will work. As I continue to add ddl's at some point
    > it throws the error. Once this eror shows, even if I remove the last (or
    > other) ddl (returing to a previously working state) the error persists.
    >
    > Confirmed every ddl had its own source/dataset.
    >
    > "Eliyahu Goldin" <> wrote in
    > message news:...
    >> Make sure that every ddl has its own collection of items. Even if the
    >> items are the same, you need to have a separate copy of them for every
    >> ddl.
    >>
    >> It may be not the culprit in your case, hard to say without seeing the
    >> code.
    >>
    >> --
    >> Eliyahu Goldin,
    >> Software Developer
    >> Microsoft MVP [ASP.NET]
    >> http://msmvps.com/blogs/egoldin
    >>
    >>
    >> "randy.buchholz" <> wrote in message
    >> news:%...
    >>> Just trying to get multiple dropdowns's to work inside another control
    >>> (details view)
    >>> I'm seeing this error, but not consistantly. I can even cut and paste a
    >>> working set of controls into a new page, and somtimes it works and other
    >>> times it throws this error.
    >>>
    >>> I'm sure this has come up before but I didn't see it in the history.
    >>> Also, the solutions I have found on the web are pretty old.
    >>> This is driving me crazy.
    >>>

    >>

    >
    >
    Eliyahu Goldin, Jul 16, 2008
    #4
  5. Yes, from what I have read about this issue this is essentially the problem.
    The issue as I understand it is that there a sequence of calls within the
    ddl processing and two of the calls are back-to-back inside the control.
    There is no way to capture an event or error between these calls, so if the
    first call provides bad or incomplete data the second call is still
    executed, generating the error. I believe this is in the space between
    databinding and databound. There a few nasty work-arounds and one that is
    not so bad - creating a custom ddl control that overrides the binding
    processes. I was hoping someone here may have heard of a better solution.

    The problem with the solutions is tied to an in-house problem. I am the
    only one in our organization that has any non-COBOL experience in the org,
    and trying to teach COBOL programmers OO concepts is proving dificult. I'm
    still a nub myself with less than 1 yr exp in .Net/C# or web/html. Haven't
    programmed in a while, spent the last 30 years in management and decided to
    get back to building things (but it seems there is no great demand for
    Fortran developers :)). Anyway, I degress. Bottom line is I am trying to
    stick to out-of the-box approaches right now for if I make things anymore
    complex than that I will end up having to do support as well as development.

    Thanks

    "Eliyahu Goldin" <> wrote in
    message news:...
    > Analyze carefully the sequence of events. See when the ddls get populated
    > and when the code is attempting to use the selected value. The likely
    > reason for the exception is the code wants the value before the ddls get
    > their items.
    >
    > --
    > Eliyahu Goldin,
    > Software Developer
    > Microsoft MVP [ASP.NET]
    > http://msmvps.com/blogs/egoldin
    > http://usableasp.net
    >
    >
    > "randy.buchholz" <> wrote in message
    > news:...
    >> Thanks Eliyahu,
    >> Would have put code if there was any not generated. It can be reproduced
    >> through dragging and dropping.
    >> I put a details view on the page, convert several fields to template
    >> fields and start adding databound ddl's to the fields. When I add new
    >> ddl and run the page it will work. As I continue to add ddl's at some
    >> point it throws the error. Once this eror shows, even if I remove the
    >> last (or other) ddl (returing to a previously working state) the error
    >> persists.
    >>
    >> Confirmed every ddl had its own source/dataset.
    >>
    >> "Eliyahu Goldin" <> wrote in
    >> message news:...
    >>> Make sure that every ddl has its own collection of items. Even if the
    >>> items are the same, you need to have a separate copy of them for every
    >>> ddl.
    >>>
    >>> It may be not the culprit in your case, hard to say without seeing the
    >>> code.
    >>>
    >>> --
    >>> Eliyahu Goldin,
    >>> Software Developer
    >>> Microsoft MVP [ASP.NET]
    >>> http://msmvps.com/blogs/egoldin
    >>>
    >>>
    >>> "randy.buchholz" <> wrote in message
    >>> news:%...
    >>>> Just trying to get multiple dropdowns's to work inside another control
    >>>> (details view)
    >>>> I'm seeing this error, but not consistantly. I can even cut and paste
    >>>> a working set of controls into a new page, and somtimes it works and
    >>>> other times it throws this error.
    >>>>
    >>>> I'm sure this has come up before but I didn't see it in the history.
    >>>> Also, the solutions I have found on the web are pretty old.
    >>>> This is driving me crazy.
    >>>>
    >>>

    >>
    >>

    >
    >
    randy.buchholz, Jul 16, 2008
    #5
    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.

Share This Page