我正在使用asp.net mvc2。
Javascript代码:
$(document).ready(function () {
$("#candidatecontact").hide();
document.getElementById("counting").value = '<%=ViewData["ResumesCount"] %>';
$('#butt2').click(function ()
{
count();
});
});
function count() {
var tempId = <%=Model.Id%>;
var url = '/Page/Count';
$.ajax({
type: "GET",
url: url,
data: { id : tempId},
dataType: "int",
success : function (count) {
SetCount(count);
}
});
}
HTML代码:
<% ViewData["ResumesCount"] = remainingHorsCount; %>
<input id = "counting" type = "text" style="width:20px;"/>
当上面文本框中的页面加载显示ViewData["ResumesCount"]
的值时..请告诉我这样做的想法?
答案 0 :(得分:0)
尝试
<input id = "counting" type = "text" value="<%= remainingHorsCount%>" style="width:20px;"/>
或
<input id = "counting" type = "text" value="<%= ViewData['ResumesCount']%>" style="width:20px;"/>