View Single Post
  #6 (permalink)  
Old March 7th, 2007, 12:39 AM
Aaron Edwards Aaron Edwards is offline
Friend of Wrox
Join Date: Apr 2004
Location: San Francisco, CA, USA.
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts

Well I figured this out.

It seems that the DropdownList's Selected Value property is only being set to "57" when the error is thrown. In other words, it starts out as "", which is what it should be, and then when I bind the ddl to a datasource, which certainly doesn't have "" as one of its items, it throws the error. That's all as it should be.

I caught it when, instead of debuggin and just waiting for the error to show up and then looking around, I stepped through the code from the beginning and watched the ddl's SelectedValue property closely. Granted, I should have done this earlier, but still, the property shouldn't have randomly changed itself when the exception was thrown like that.

Usually I bind my dropdowns declaritively, but this is a special case. I'm populating them manually from here on out, in a for each loop, then adding a null item at the top. Seems to be working.



Reply With Quote