[RESOLVED] Sending Data Between Iframes.

Hi

I've got a situation where there is a page with 3 iframes. The first frame contains a TreeView, the second a GridView which is dependent on the selected node of the Treeview in frame 1 and the third frame contains labels with information also dependent on the TreeView in the first frame.

My problem is, how do I pass information from the first frame to the others? Can I access information about the selected node in JavaScript, pass it to another frame and then do a postback with the info as an argument?


Thanks

Hi

You can see explaination here from

sharing variables between windows and frames

accessing variables from one frame to another

Now, sharing variables between frames is not really any different than sharing them between windows. All you need is a reference to the frame object.

For example, if a window has two frames, the first frame can access a variable in the second frame using the following expression:

Example: first frame accessing second frame's variable

parent . frames [1] .
variable_name

Similarly, the second frame can access variables in the first frame through the following expression:

Example: second frame accessing first frame's variable

parent . frames [0] . 
variable_name

As illustrated in these examples, frames can obtain references to neighboring frames through the parent window's

frames []
property. Don't forget that the first frame in this array is indexed with 0, not 1.


Regards

shabir

Hi

Thanks, I have no problem passing JavaScript variables between frames, the problem is how do I pass info from the server control to JavaScript? I've been experimenting with the IscriptControl interface, I'd like to bind a function to the window's onload event so after the user clicks on the TreeFrame it does a postback and when the window has finished loading it can pass the selected node onto the other frame with the gridview.

Regards

Hi,

You can consider to pass value between Iframe by using QueryString in Iframe src property.

Like:

<iframe id="frm" src="page.aspx?p1=1">

Or code behind:

Iframe.Attributes["src"] = "page.aspx?p1=" + HttpUtility.UrlEncode(p1);

You can check this link:

http://www.codeproject.com/KB/aspnet/IFrameParams.aspx

Hope this can help you.

thoughts on "[RESOLVED] Sending Data Between Iframes."

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>