上面我已經表明我的動態UI,我根據日期設定的ID動態的相關領域的方式。
所以我需要論文的數據發送到MVC控制器作爲陣列阿賈克斯後,然後從中挑選那些東西里面controller.This應該發生了,當我點擊保存按鈕
我的崗位方法如下(沒有上述陣列詳情):
$("#clocked-details").find("#btnSave").die('click').live('click', function() {
var yearValue = $("#year").val();
var monthValue = $("#month").val();
$.ajax({
url: "/Employees/UpdateEmployeeClockedHoursByProvider",
type: 'POST',
cache: false,
data: { employeeId: employeeId, year: yearValue, month: monthValue },
success: function (result) {
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});
return false;
});
我的控制器是如下面(無jquery的陣列maupulation):
[HttpPost]
public void UpdateEmployeeClockedHoursByProvider(Guid employeeId, int year, int month)
{
}
更新
UI已經使用下面生成提到代碼:
<% foreach (var ec in Model)
{%>
<tr>
<td>
<%: ec.ClockedDate.ToString("yyyy-MM-dd") %>
</td>
<td>
<input type="number" id="<%: ec.ClockedDate.ToString("yyyy-MM-dd") %>-hours" name="<%: ec.ClockedDate.ToString("yyyy-MM-dd") %>-hours"
class="total-hours" placeholder="Hours" value="<%: ec.TotalHours %>" />
</td>
<td>
<input type="number" id="<%: ec.ClockedDate.ToString("yyyy-MM-dd") %>-minutes" name="<%: ec.ClockedDate.ToString("yyyy-MM-dd") %>-minutes"
class="total-minutes" placeholder="Minutes" value="<%: ec.TotalMinutes %>" />
</td>
</tr>
<% }%>
我的問題:
如何通過使用Ajax來發送上述每行數據的動態2場?
如何操縱控制器內的數組?
動態2領域的意義? 由MVC Helper動態生成的文本框? – Vitthal 2013-03-16 09:09:47
@Vitthal plz檢查我的「更新」部分。 – Sampath 2013-03-16 09:13:19
@Vitthal那麼我怎樣才能從服務器端獲得每一行的值? – Sampath 2013-03-16 09:21:15