StrataFrame Forum

Problem with Dropdown List on webform if bound BO has no records

http://forum.strataframe.net/Topic29970.aspx

By Andrew Harper - 5/11/2011

Hi,

I have a webform  for maintaining users that contains 2 dropdown lists for selection: lstCustomers and lstUsers, and a third dropdown list lstUserType  populated from boUserType which displays the type of the selected user.

lstCustomers is populated from BO boCustomers and lstUsers is populated with users for the selected customer from lstCustomers using BO  boUsers.

In the selection changed event for lstCustomers I repopulate boUsers and refresh the display of lstUsers.

All is working fine except for when I select a customer that has no users. In this case I get an error

lstUserType' has a SelectedValue which is invalid because it does not exist in the list of items.

Any suggestions on how to get around this most greatfully received,

TIA

Andy

 
By Greg McGuffey - 5/11/2011

I'm thinking that the user type combo has a value that is appropriate for the situation where this is no customer, but you haven't handled that case, likely in populating the user type combo. I haven't done this in a while, but I think the TopMostItem on the user type combo to match the value when there is no customer. That's where I'd start.