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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • randy.buchholz

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

    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

    #2
    Re: Any good solutions for: SelectedValue which is invalid because it does not exist in the list of items?

    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]



    "randy.buchholz " <randy.buchholz @dads.state.tx. uswrote in message
    news:%23fHjSae5 IHA.2332@TK2MSF TNGP03.phx.gbl. ..
    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.
    >

    Comment

    • randy.buchholz

      #3
      Re: Any good solutions for: SelectedValue which is invalid because it does not exist in the list of items?

      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" <REMOVEALLCAPIT ALSeEgGoldDinN@ mMvVpPsS.orgwro te in
      message news:e9lhgQf5IH A.2060@TK2MSFTN GP02.phx.gbl...
      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]

      >
      >
      "randy.buchholz " <randy.buchholz @dads.state.tx. uswrote in message
      news:%23fHjSae5 IHA.2332@TK2MSF TNGP03.phx.gbl. ..
      >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.
      >>
      >

      Comment

      • Eliyahu Goldin

        #4
        Re: Any good solutions for: SelectedValue which is invalid because it does not exist in the list of items?

        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]




        "randy.buchholz " <randy.buchholz @dads.state.tx. uswrote in message
        news:uzrwZoo5IH A.2348@TK2MSFTN GP06.phx.gbl...
        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" <REMOVEALLCAPIT ALSeEgGoldDinN@ mMvVpPsS.orgwro te in
        message news:e9lhgQf5IH A.2060@TK2MSFTN GP02.phx.gbl...
        >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.buchhol z" <randy.buchholz @dads.state.tx. uswrote in message
        >news:%23fHjSae 5IHA.2332@TK2MS FTNGP03.phx.gbl ...
        >>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.
        >>>
        >>
        >
        >

        Comment

        • randy.buchholz

          #5
          Re: Any good solutions for: SelectedValue which is invalid because it does not exist in the list of items?

          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" <REMOVEALLCAPIT ALSeEgGoldDinN@ mMvVpPsS.orgwro te in
          message news:Ohu30Ty5IH A.1192@TK2MSFTN GP05.phx.gbl...
          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]


          >
          >
          "randy.buchholz " <randy.buchholz @dads.state.tx. uswrote in message
          news:uzrwZoo5IH A.2348@TK2MSFTN GP06.phx.gbl...
          >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" <REMOVEALLCAPIT ALSeEgGoldDinN@ mMvVpPsS.orgwro te in
          >message news:e9lhgQf5IH A.2060@TK2MSFTN GP02.phx.gbl...
          >>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.buchho lz" <randy.buchholz @dads.state.tx. uswrote in message
          >>news:%23fHjSa e5IHA.2332@TK2M SFTNGP03.phx.gb l...
          >>>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.
          >>>>
          >>>
          >>
          >>
          >
          >

          Comment

          Working...