创建从code。将HTML隐藏背后的控制 [英] Creating an HTML hidden control from code behind

查看:112
本文介绍了创建从code。将HTML隐藏背后的控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,我想创建一个隐藏字段搜索一个母版应用
< ASP:HiddenField ID =hdnField=服务器VALUE =/>

I have a Masterpage application where I want to create a hidden field
<asp:HiddenField ID="hdnField" runat="server" Value=""/>

,以获得客户端的时间,所以我下面的选项建议哪有我得到的客户机的时区?。但是,因为我的应用程序是一个母版的应用程序,我的问题是:我应该在哪里创建的aspx文件隐藏的控制(在文件名为.master ...或者在孩子aspx页面或者我应该上的Page_Load事件创建在的.cs页)?

in order to get the client-side time, so I am following an option suggested "How can i get timezone of the client machine?". However, since my application is a Masterpage app, my question is: where should I create the hidden control in the aspx file (in the .master file... or in the child aspx page or should I create it on the page_load event on the .cs page) ?

推荐答案

只需添加你在你的.master页面上你的问题有标记。请确保它位于里面的&LT;形式的方式&gt; 标签

Just add the markup that you have in your question in your .master page. Make sure that it is located inside the <form> tag.

您的脚本(也在母版)是这样的:

Your script (also in the masterpage) would look like this:

document.getElementById("<%=this.hdnField.ClientID%>").value = "...";

这篇关于创建从code。将HTML隐藏背后的控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆