我有一个<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