我有一个textareafor
<div class="inner-addon left-addon">
Html.TextAreaFor(m => m.DataFixes, new { @class = "resizedTextbox", id = "txtDataFixes", placeholder = "Data Fixes" , style = "width : 70px,height : 70px;" })
</div>
我使用jquery使用按钮点击保存数据。当我点击保存按钮然后我可以将数据保存在文本框中,当输入的数据很小时,但是当我尝试保存冗长的数据时,它不会被保存。以下是我的jquery代码。我认为它与var对象有关。
$('#btnUpdateDataSet').click(function() {
var note = $("#txtNote").val();
var fileContentName = $("#txtFileContentName").val();
var fileContentId = $("#fileContentId").val();
var dataFixes = $("#txtDataFixes").val();
var oldWorkitemId = $('#drpOldWorkitemId option:selected').val();
if (fileContentName.length == 0) {
var fileContentId = null;
} else {
var fileContentId = $("#fileContentId").val();
}
updateDataSet(workItemID, dataSetDateStamp, cycle, reference, feed, source, target, lineStart, extension, note, fileContentId, dataFixes, oldWorkitemId);
});
以下是我的控制器
public ActionResult EditDataSet( string dataFixes)
{
EditDataSetVM editDataSetVM = new EditDataSetVM();
editDataSetVM.DataFixes = dataFixes;
return PartialView("EditDataSetView", editDataSetVM);
}
我的Ajax电话
function updateDataSet(workItemID, dataSetDateStamp, cycle, reference, feed, source, target, lineStart, extension, note, fileContentId, dataFixes,oldWorkitemId) {
$.ajax({
type: "POST",
url: "/DataSet/UpDateDataSetDetails",
contentType: "application/json; charset=utf-8",
data: { "workItemId": workItemID, "dataSetDateStamp":
dataSetDateStamp, "cycle": cycle, "reference": reference, "feed": feed, "source": source, "target": target, "lineStart": lineStart, "extension":
extension, "note": note, "fileContentId": fileContentId, "dataFixes":
dataFixes, "oldWorkitemId": oldWorkitemId },
datatype: "json",
success: function (data) {
if (data == "Update Succeeded") {
$("#btnViewDataSet").click();
}
else {
$("div.toshow").show();
$('#lblUpdateDataSetResult').html('Following error(s) occured:<br\>' + data);
}
},
error: function () {
alert("Update WorkItem metadata failed.");
}
});
}