PDA

View Full Version : [CLOSED] JSON deserialisation issue with multicombo boxes.



machinableed
Jun 01, 2012, 8:11 AM
I have a form panel that is submitting through to a controller method that receives the form fields and needs to deserialise it. This works fine for text fields, but for combo boxes I get an error such as:


"Error reading string. Unexpected token: StartArray. Path 'mcbBillingStatus', line 1, position 59."

The input string is typically something like this (by default):

"{\"txtServiceId\":\"\",\"txtServiceName\":\"\",\"mcbBillingStatus\":[],\"txtCustomerReference\":\"\",\"txtServiceAlias\":\"\",\"mcbOperationalStatus\":[],\"txtServiceReference\":\"\",\"txtSalesOrderNumber\":\"\",\"ddtServiceType\":null,\"txtMinMonthlyAmount\":\"\",\"id64bab6e3f30086b5\":\"(MIN) - $ \",\"txtMaxMonthlyAmount\":\"\",\"idce170880d87c86b5\":\"(MAX)\",\"cmbCustomer\":null}"

as you can see, if there is no selected value in the multi combo, it just comes back as [] and fails on the JSON.deserialize call. I've tried setting the empty value attribute with no luck - it seems to be ignored altogether (perhaps this is because I have the EmptyText attribute used also?)

thanks

Daniil
Jun 01, 2012, 10:54 AM
Hi,

Well, I guess the question is related to this one?
http://forums.ext.net/showthread.php?19190&p=83049&viewfull=1#post83049

Well, in the case with MultiCombo I think you should use:

Dictionary<string, object>

Because an array cannot be deserialized to string.