我想在表单中使用jQuery multiselect插件编辑jqGrid(添加表单)。asp.net jqGrid下拉多选择
这是我使用建下拉代码(colModel
摘录):
{
name: 'CaratteristicheCamera',
index: 'CaratteristicheCamera',
width: 50,
hidden: true,
edittype: 'select',
editable: true,
editrules: { edithidden: true, required: true },
editoptions: {
multiselect: true,
dataUrl: '<%# ResolveUrl("~/Service/Domain/ServiceRoom.asmx/GetRoomFeatureList") %>',
buildSelect: function (data) {
var retValue = $.parseJSON(data);
var response = $.parseJSON(retValue.d);
var s = '<select id="CaratteristicheCamera" name="CaratteristicheCamera">';
if (response && response.length) {
for (var i = 0, l = response.length; i < l; i++) {
s += '<option value="' + response[i]["Id"] + '">' +
response[i]["Descrizione"] + '</option>';
}
}
return s + "</select>";
},
dataInit: function() {
$("#CaratteristicheCamera").multiselect();
}
}
},
正如你们所看到的,jqGrid的调用的WebMethod放在ASMX文件。一切似乎工作正常,但我无法收到用户从下拉列表中选择的所有值。看来系统发送给服务器最后一个选择。 你有任何提示吗?
编辑:这是ASMX web服务声明
[WebMethod]
public string SaveRoom(string id, string codice, string Numero, string NumeroPiano,
string Nome, string TipoCamera, string StatoCamera,
string CaratteristicheCamera, string TipoSdoppiabilita)
{}
你能否指定更确切的来自你尝试使用的“multiselect”插件。是Eric Hynds [jQuery UI MultiSelect Widget](https://github.com/ehynds/jquery-ui-multiselect-widget)?你能描述一下更为详细的现存问题吗?您写下了“我无法接收用户从下拉列表中选择的所有值”。用户选择列表是否被剪切?你另外写了另外一个问题:“系统发送给服务器最后一个选择”。你的意思是**以前的**选择?因此,如果您第二次打开表单,用户的第一个选择将被发送到服务器? – Oleg 2012-04-03 10:54:44
是的,我使用Eric Hynds图书馆(v 1.12)。会发生什么是我点击加号图标来添加新的实体;它会出现在窗体中,我可以填充它的所有字段,并且可以在CaratteristicheCamera下拉列表中选择多个项目。然后,我点击保存按钮,系统调用asmx webmethod,但在参数中我看到,通过调试,只是最后选择的项目。 (我编辑我的问题) – frabiacca 2012-04-03 11:05:14