locked
'cboEmployee' has a SelectedValue which is invalid because it does not exist in the list of items. RRS feed

  • Question

  • User823789806 posted

    I got that error on this line

    ---> cboEmployee.Text = gridSearchDetails.SelectedRow.Cells[2].Text; <---

    what does it mean?? What am I going to do... All values on the cells[2] were from combo box Employee...

    Can somebody help me plz???

    Thursday, June 2, 2011 9:43 PM

Answers

  • User-1696077569 posted

    Can you put in a debugger and check value of gridSearchDetails.SelectedRow.Cells[2].Text

    Is this value present in dropdown

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 3, 2011 12:14 AM

All replies

  • User-1696077569 posted

    There can be many reasons for your problem..Below thread might be useful..please have a look

    http://blog.evonet.com.au/post/dropdownlist1-has-a-SelectedValue-which-is-invalid-because-it-does-not-exist-in-the-list-of-items.aspx
    
    http://programmingrealizations.blogspot.com/2009/04/dropdownlist-has-selectedvalue-which-is.html
    
    
    Thursday, June 2, 2011 11:05 PM
  • User823789806 posted

    I am confused with your example because it was demonstrated on the aspx page.  do you have other sxample on the code window using c#

    regarding my problem?? thanks...

    Friday, June 3, 2011 12:06 AM
  • User-1696077569 posted

    Can you put in a debugger and check value of gridSearchDetails.SelectedRow.Cells[2].Text

    Is this value present in dropdown

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 3, 2011 12:14 AM
  • User823789806 posted

    I figured it out. I used a loop to check the value of the selected index and to match the value on the drop down. thank you very much for the idea... hope to help me more when im confused. thanks again sir..

    Friday, June 3, 2011 1:59 AM