500 Error on Submit with DropDownCheckBoxList
7 min
Summary
Submitting a form containing a DropDownCheckBoxList can result in a 500 Internal Server Error due to an invalid binding configuration. The issue manifests as an XPath evaluation failure during model binding.
Symptoms
- HTTP Response: 500 Internal Server Error
- Endpoint: POST /webapi/Job/current/step/0
- UI Behaviour: Error occurs when submitting the form (not during initial load)
Error Details
<Error>
<Message>Exception has been thrown by the target of an invocation.</Message>
<Details>
System.Xml.XPath.XPathException: Expression must evaluate to a node-set.
</Details>
</Error>Affected Control Configuration
<DropDownCheckBoxList
ID="licenseType"
ActivateBind="licenseType"
Label="License Type"
DataValueField="LicenseTypeId"
DataTextField="Name"
BindingStyle="ValueList">
</DropDownCheckBoxList>Root Cause
The issue is caused by an incorrect BindingStyle configuration.
- DropDownCheckBoxList returns multiple selected values
- Example output: 1,2
- BindingStyle="ValueList" does not correctly handle this format during submit
- During model binding, the value is processed by the XML layer (XmlValue.Set), which attempts to evaluate it as part of an XPath expression
- This results in: XPathException: Expression must evaluate to a node-set
Resolution
Update the control to use EnumList:
<DropDownCheckBoxList
ID="licenseType"
ActivateBind="licenseType"
Label="License Type"
DataValueField="LicenseTypeId"
DataTextField="Name"
BindingStyle="EnumList">
</DropDownCheckBoxList>Outcome
- Multi-select values are correctly handled as a comma-separated list (e.g. 1,2)
- Model binding completes successfully
- No XPath evaluation error
- Form submission succeeds
Key Takeaway
For DropDownCheckBoxList controls that return multiple values, always use:
BindingStyle="EnumList"
Using ValueList in this scenario can cause binding failures and server-side XPath exceptions during form submission.