Formview to bind dropdownlist - error if selectedvalue not matched

WONG Tony 161 Reputation points
2023-08-09T08:19:24.7933333+00:00

The dropdownlist is a list of staff

When formview is at Insert mode, the dropdownlist shows staff with status = true. then users can only select present staff, not resigned staff

When formview is at read only, the label shows all staff whether status = true or false, then the record show the staff whether present or resigned

However, when formview at edit mode,

Method 1
if dropdownlist selectedvalue is bind to all staff, user can select resigned staff which is not my design intention but no error in Method 2.

Method 2

if dropdownlist selectedvalue is bind to present staff only, old record with resigned staff will bind in error.

Possible to let Dropdownlist to stay at 1st item if the selectedvalue is not matched? Thank you.

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,598 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.