![](/img/trans.png)
[英]textbox value set in javascript is not avaliable in serverside page load event
[英]On page load show the value in textbox in javascript
我正在使用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"]
..的值時,請給我一些想法嗎?
嘗試
<input id = "counting" type = "text" value="<%= remainingHorsCount%>" style="width:20px;"/>
要么
<input id = "counting" type = "text" value="<%= ViewData['ResumesCount']%>" style="width:20px;"/>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.