Доступ к значению скрытого поля на главной странице из codebehind
В продолжение моего предыдущеговопросЯ хочу получить значение скрытого поля ввода из дочерней страницы кода.
Я пыталсяHtmlInputHidden hdnID = (HtmlInputHidden)Page.Master.FindControl("ctl00_hdnField");
но я получаю "нулевое" значение.
Фрагмент главной страницы:
<head runat="server">
<title>
<asp:ContentPlaceHolder ID="TitleContent" runat="server"></asp:ContentPlaceHolder>
<asp:Literal ID="Literal2" runat="server" Text=" : Logistics Management" />
</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="~/css/styles.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder ID="ScriptCssContent" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
......
......
......
<div id="container">
....
....
....
<div id="content" style="z-index:0;">
<asp:HiddenField ID="hdnField" runat="server" Value=""/>
....
....
....
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
</div>
</div>
</form>
На моей странице aspx Child у меня есть этот блок JavaScript:
window.onload = function() {
var newDate = new Date();
var hidField = document.getElementById("ctl00_hdnField");
if (hidField != null)
hidField.value = newDate.toLocaleString();
}
Когда я "Добавить часы" в
document.getElementById ( "ctl00_hdnField")
значение верное.
Вопрос: Как мне получить доступ к значению внутри элемента управления hdnField, из codebehind?