我有一個<asp:menu/>
控制和隱藏field.Now我使用jQuery來更改隱藏字段的值。 代碼是: -如何獲得隱藏的字段值後面的代碼更新由jquery/javascript
$(function() {
$(".primaryStaticMenu tr,td").each(function(index) {
$(this).click(function() {
if ($(this).attr("title") != "undefined"
&& $(this).attr("title").length > 0) {
document.getElementById('ctl00_Hidden_Master_Location').value = $(this).attr("title");
alert(document.getElementById('ctl00_Hidden_Master_Location').value);
//return false;
}
});
});
});
服務器端代碼以獲取更新的值是: -
string Get_cng_value = Hidden_Master_Location.Value;
但Hidden_Master_Location.Value
顯示null
每次。 任何人都可以告訴我如何從後面的代碼中獲取隱藏字段的更新值。
請爲hidde提供aspx頁面代碼n字段 – 2013-03-05 06:26:00
此行在瀏覽器中提示什麼? alert(document.getElementById('ctl00_Hidden_Master_Location')。value); – 2013-03-05 06:27:02
我是jquery的新手,但隱藏字段的id是'ctl00_Hidden_Master_Location',不應該用它來代替Hidden_Master_Location.Value在服務器代碼中引用它嗎? – Aashray 2013-03-05 06:28:57