[英]How to pass a server side property value to other htm page loaded in frame withing aspx page
In a web application, I have a default.aspx page and have a button at top and shown below: 在Web应用程序中,我有一个default.aspx页面,并在顶部有一个按钮,如下所示:
When I click the Button-1, a frame is loaded in my page containing two other frames in a frameset. 当我单击Button-1时,一个框架被加载到我的页面中,该框架在框架集中包含另外两个框架。 Each frame in frameset loads a htm page.
框架集中的每个框架都加载一个htm页面。 You can see this as below:
您可以看到以下内容:
So, hierarchy is as below: 因此,层次结构如下:
What I need to do, I want to set the value of Button-2 in Header.htm and that value is assigned to a javascript variable on Default.aspx load. 我需要做的是,我想在Header.htm中设置Button-2的值,并将该值分配给Default.aspx加载时的javascript变量。
I try this var sJSButton2Value = '<%=sButton2Title %>';
我尝试这个
var sJSButton2Value = '<%=sButton2Title %>';
sButton2Title comes from server side script depending upon user language. sButton2Title来自服务器端脚本,具体取决于用户语言。
How, can I pass this to Header.htm from Default.aspx ? 如何将其从Default.aspx传递给Header.htm?
I want to set Button-2 value which is coming from Default.aspx page. 我想设置来自Default.aspx页的Button-2值。
How It can be accomplished ? 如何实现?
You can set the variable in Default.aspx from an iframe like this: 您可以像这样通过iframe在Default.aspx中设置变量:
From inside the iframe: 从iframe内部:
window.parent.SomeFunctionDefinedInDefaultAspx(valueToSet);
This is typically how you would access the "parent" (Default.aspx) of the iframe 通常,这就是您访问iframe的“父级”(Default.aspx)的方式
f you need the button text to be set in the iframe from Default.aspx, you can do that via querystring in the url your specify for the iframe 如果您需要在Default.aspx的iframe中设置按钮文本,则可以通过为iframe指定的网址中的querystring来实现
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.