我得到它的工作只是yesterday..here是我的文件上傳colModel列,
{
name: 'fileToUpload',
index: 'customer_id',
align: 'left',
editable: true,
edittype: 'file',
editoptions: {
enctype: "multipart/form-data"
},
width: 210,
align: 'center',
formatter: jgImageFormatter,
search: false
}
你必須設置afterSubmit:UploadImage。它只在數據已經過後&回覆後才上傳文件。我在這裏檢查,如果插入是succesfful然後只開始上傳其他顯示錯誤。我用Jquery Ajax File Uploader。
function UploadImage(response, postdata) {
var data = $.parseJSON(response.responseText);
if (data.success == true) {
if ($("#fileToUpload").val() != "") {
ajaxFileUpload(data.id);
}
}
return [data.success, data.message, data.id];
}
function ajaxFileUpload(id)
{
$("#loading")
.ajaxStart(function() {
$(this).show();
})
.ajaxComplete(function() {
$(this).hide();
});
$.ajaxFileUpload
(
{
url: '@Url.Action("UploadImage")',
secureuri: false,
fileElementId: 'fileToUpload',
dataType: 'json',
data: { id: id },
success: function (data, status) {
if (typeof (data.success) != 'undefined') {
if (data.success == true) {
return;
} else {
alert(data.message);
}
}
else {
return alert('Failed to upload logo!');
}
},
error: function (data, status, e) {
return alert('Failed to upload logo!');
}
}
) }
您的鏈接使我在一個這樣的頁面發送給我,我沒有發現任何線索,因爲您告訴我們它是一個很好的例子。 – Tareq
下載ASP.NET MVC中的jqGrid - 編輯,TinyMCE,上傳(http://tpeczek.codeplex.com/releases/view/63305)。這是一個工作版本 – Dranix