我的 aspx 页面中有一个隐藏变量,即 mainpage.aspx
<asp:HiddenField runat="server" id="hdnCommonvCode" />
mainpage.aspx 包含 tabcontainer 控件。在每个选项卡上添加一个用户控件。如果我尝试访问这个隐藏字段 alert($find("<%=hdnCommonvasCode.ClientID %>"));
从用户控件显示编译器错误消息
Compiler Error Message: CS0103: The name 'hdnCommonvCode' does not exist in the current context
最佳答案
您是否尝试过这样var hidx = document.getElementById('hdnCommonvCode');
关于javascript - 如何从用户控件访问隐藏字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5786375/