1

我正在 C# 上使用一个简单的 MultiSelectList。

我只想用一些字符串值填充这个 MultiSelectList(不是一对,例如 <"Key"、"Value"> 只是 <"Value">)并设置一些选定的项目。

这是我的代码:

IEnumerable<string> ubicaciones = new string[] { "NEGOCIOS", "TERRITORIOS", 
                                                       "LOCALIDADES" };
IEnumerable<string> ubicacionesSelected = Ubicaciones.Split(',');
UbicacionesPermitidas = new MultiSelectList(ubicaciones, ubicacionesSelected);

IEnumerable<string> transacciones = new string[] { "CARGA: ACCESORIOS", 
                    "CARGA: EQUIPOS", "ASIGNACIONES", "DESINCORPORACIONES", 
                    "PRÉSTAMOS", "TRASLADOS", "SALIDAS" };
IEnumerable<string> transaccionesSelected = Transacciones.Split(',');
TransaccionesPermitidas = new MultiSelectList(transacciones, 
                                  transaccionesSelected);

但是,不起作用...(它显示了 MultiSelectList 上的所有值,但没有显示任何选定的项目)我错过了什么?

谢谢。

4

1 回答 1

0

The values in Ubicaciones do not match up with the values in ubicaciones. It's the same with Transacciones and transacciones. If you don't believe that that's the case, please post the code which defines Ubicaciones and Transacciones and we can troubleshoot it further.

于 2011-01-11T15:16:12.477 回答