Why can't jQuery jqGrid default my combobox co

2019-09-06 06:50发布

问题:

I am using jqGrid with ASP.NET MVC. I have an edit form which works great, but for some reason I have one combobox field that doesn't default to the current selected row after the first time I bring up the edit form.

I have found the root cause. The values in the dropdown all have commas in them as they are showing name in the format:

[LastName, FirstName]

When I remove the comma from the select values, the problem goes away.

Is there any way to support commas in a select dropdown on a jqGrid edit form?

回答1:

Probably you will find the answer on your question here: you should use object instead of string as the value of the value option for the list of select values.